提交 57969af0 编写于 作者: O Olaf Hering 提交者: Greg Kroah-Hartman

Tools: hv: in kvp_set_ip_info free mac_addr right after usage

... to simplify error path in upcoming changes.
Signed-off-by: NOlaf Hering <olaf@aepfle.de>
Signed-off-by: NK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 dafffd88
...@@ -1299,6 +1299,7 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val) ...@@ -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); error = kvp_write_file(file, "HWADDR", "", mac_addr);
free(mac_addr);
if (error) if (error)
goto setval_error; goto setval_error;
...@@ -1344,7 +1345,6 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val) ...@@ -1344,7 +1345,6 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
goto setval_error; goto setval_error;
setval_done: setval_done:
free(mac_addr);
fclose(file); fclose(file);
/* /*
...@@ -1358,7 +1358,6 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val) ...@@ -1358,7 +1358,6 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
setval_error: setval_error:
syslog(LOG_ERR, "Failed to write config file"); syslog(LOG_ERR, "Failed to write config file");
free(mac_addr);
fclose(file); fclose(file);
return error; return error;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册