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 <patrick@stwcx.xyz>
diff --git a/writefrudata.C b/writefrudata.C
index ee94d79..bccaf0a 100644
--- a/writefrudata.C
+++ b/writefrudata.C
@@ -171,7 +171,8 @@
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 @@
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__