Tools: hv: in kvp_set_ip_info free mac_addr right after usage
authorOlaf Hering <olaf@aepfle.de>
Sun, 4 Aug 2013 14:41:24 +0000 (16:41 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Aug 2013 06:36:31 +0000 (14:36 +0800)
... to simplify error path in upcoming changes.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/hv/hv_kvp_daemon.c

index 418ac5548f98c5e1b52af04153c253061c616131..ba075e514422e434b46f0690b019bedb6806fa3a 100644 (file)
@@ -1299,6 +1299,7 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
        }
 
        error = kvp_write_file(file, "HWADDR", "", mac_addr);
+       free(mac_addr);
        if (error)
                goto setval_error;
 
@@ -1344,7 +1345,6 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
                goto setval_error;
 
 setval_done:
-       free(mac_addr);
        fclose(file);
 
        /*
@@ -1358,7 +1358,6 @@ setval_done:
 
 setval_error:
        syslog(LOG_ERR, "Failed to write config file");
-       free(mac_addr);
        fclose(file);
        return error;
 }