From 804077dd3c34906147df98cf1ce865133ef5d609 Mon Sep 17 00:00:00 2001 From: Patrick Williams Date: Fri, 29 Jul 2016 15:26:18 -0500 Subject: Improper use of non-const c-string. sd_bus_message_read(..."s"...) gives a pointer to a char* from within the message. Even though the message is in writable memory, it is generally bad to write to the char* from within it. Also, as a reviewer it is less of a concern to see a const char* that is lacking a free than it is a char*. Changing to const char* hopefully avoids the confusion as to why the c-string does not have a corresponding free. Eventually this code will likely transition over to the sdbusplus interfaces and this will be irrelevant. Change-Id: I0dfe948bb2f0eee03042ba9b9dc7563995f59027 Signed-off-by: Patrick Williams --- writefrudata.C | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/writefrudata.C b/writefrudata.C index ee94d79..bccaf0a 100644 --- a/writefrudata.C +++ b/writefrudata.C @@ -171,7 +171,8 @@ int ipmi_fru::setup_sd_bus_paths(void) int rc = 0; // What we need is BOARD_1, PRODUCT_1, CHASSIS_1 etc.. - char *inv_bus_name = NULL, *inv_obj_path, *inv_intf_name; + const char *inv_bus_name = NULL, *inv_obj_path = NULL, + *inv_intf_name = NULL; char fru_area_name[16] = {0}; char *sys_bus_name = NULL; sprintf(fru_area_name,"%s%d",iv_name.c_str(), iv_fruid); @@ -595,7 +596,7 @@ int get_defined_fru_area(sd_bus *bus_type, const uint8_t fruid, sd_bus_error bus_error = SD_BUS_ERROR_NULL; sd_bus_message *response = NULL; int rc = 0; - char *areas = NULL; + const char *areas = NULL; char *sys_bus_name = NULL; #ifdef __IPMI_DEBUG__ -- cgit v1.2.1