[PATCH phosphor-host-ipmid] Fix memory leak in good paths in ipmid

OpenBMC Patches openbmc-patches at stwcx.xyz
Sat Feb 27 05:00:44 AEDT 2016


From: vishwa <vishwanath at in.ibm.com>

---
 apphandler.C       |  3 +++
 transporthandler.C | 12 ++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/apphandler.C b/apphandler.C
index a48059f..59eedd4 100644
--- a/apphandler.C
+++ b/apphandler.C
@@ -203,6 +203,7 @@ ipmi_ret_t ipmi_app_get_device_guid(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
 
     sd_bus_error_free(&error);
     sd_bus_message_unref(m);
+    sd_bus_message_unref(reply);
 
     return rc;
 }
@@ -311,6 +312,7 @@ ipmi_ret_t ipmi_app_set_watchdog(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
 
     sd_bus_error_free(&error);
     sd_bus_message_unref(m);
+    sd_bus_message_unref(reply);
 
     return rc;
 }
@@ -347,6 +349,7 @@ ipmi_ret_t ipmi_app_reset_watchdog(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
 
     sd_bus_error_free(&error);
     sd_bus_message_unref(m);
+    sd_bus_message_unref(reply);
 
     return rc;
 }
diff --git a/transporthandler.C b/transporthandler.C
index d43f1f9..f511d58 100644
--- a/transporthandler.C
+++ b/transporthandler.C
@@ -189,6 +189,10 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
         return IPMI_CC_PARM_NOT_SUPPORTED;
     }
 
+    sd_bus_message_unref(reply);
+    sd_bus_message_unref(m);
+    sd_bus_error_free(&error);
+
     return rc;
 }
 
@@ -287,6 +291,10 @@ ipmi_ret_t ipmi_transport_get_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
             return -1;
         }
 
+        sd_bus_message_unref(reply);
+        sd_bus_message_unref(m);
+        sd_bus_error_free(&error);
+
         printf("%s:%d:%d:%d:%s\n", family==AF_INET?"IPv4":"IPv6", prefixlen, scope, flags, saddr);
 
         memcpy((void*)&buf[0], &current_revision, 1);
@@ -347,6 +355,10 @@ ipmi_ret_t ipmi_transport_get_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
             return IPMI_CC_RESPONSE_ERROR;
         }
 
+        sd_bus_message_unref(reply);
+        sd_bus_message_unref(m);
+        sd_bus_error_free(&error);
+
         memcpy((void*)&buf[0], &current_revision, 1);
 
         char *tokptr = NULL;
-- 
2.7.1




More information about the openbmc mailing list