ovs_stats: fix memory leak
authorMark Kavanagh <mark.b.kavanagh@intel.com>
Thu, 22 Feb 2018 11:55:44 +0000 (11:55 +0000)
committerCiara Loftus <ciara.loftus@intel.com>
Tue, 27 Mar 2018 09:47:14 +0000 (10:47 +0100)
In ovs_stats_plugin_config(), memory may be allocated from the heap,
but is not subsequently freed in the case of failure later in the
function.

Fixes: bcf9c48 ("ovs_stats plugin: Fix a memory leak.")
Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
src/ovs_stats.c

index 1e6ddd2..f56e12b 100644 (file)
@@ -849,6 +849,7 @@ static int ovs_stats_plugin_config(oconfig_item_t *ci) {
             char *br_name_dup = strdup(br_name);
             if (br_name_dup == NULL) {
               ERROR("%s: strdup() copy bridge name fail", plugin_name);
+              sfree(bridge);
               goto cleanup_fail;
             }