# HG changeset patch
# User Eduardo Lima (Etrunko) <eblima(a)br.ibm.com>
# Date 1312918075 10800
# Node ID 8759e60c17c42101118f914215d071138340c70f
# Parent 0291fb05e93a0cbcbf2b80c894a47d58f7c37d23
VirtualSystemManagementService: Fixing potential null dereferences and leaks
As reported in
https://bugzilla.redhat.com/show_bug.cgi?id=728245
line 1048 - Comparing "path" to null implies that "path" might be
null.
line 1057 - Dereferencing null variable "path".
line 1088 - Comparing "port" to null implies that "port" might be
null.
line 1094 - Dereferencing null variable "port".
Signed-off-by: Eduardo Lima (Etrunko) <eblima(a)br.ibm.com>
diff --git a/src/Virt_VirtualSystemManagementService.c
b/src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c
+++ b/src/Virt_VirtualSystemManagementService.c
@@ -1054,8 +1054,12 @@
ret = 1;
out:
- CU_DEBUG("Exiting parse_console_address, ip is %s, port is %s",
- *path, *port);
+ free(tmp_path);
+ free(tmp_port);
+
+ if (path && port)
+ CU_DEBUG("Exiting parse_console_address, ip is %s, port is %s",
+ *path, *port);
return ret;
}
@@ -1091,8 +1095,12 @@
ret = 1;
out:
- CU_DEBUG("Exiting parse_vnc_address, ip is %s, port is %s",
- *ip, *port);
+ free(tmp_ip);
+ free(tmp_port);
+
+ if (ip && port)
+ CU_DEBUG("Exiting parse_vnc_address, ip is %s, port is %s",
+ *ip, *port);
return ret;
}