# HG changeset patch
# User Eduardo Lima (Etrunko) <eblima(a)br.ibm.com>
# Date 1312918075 10800
# Node ID a346baf140d64177a9dc1066677c307ee6518236
# Parent 90ba6e1f899ea3ec47bc175e86bd245983e9375f
VirtualSystemManagementService: Fixing potential null dereferences
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".
Changes since #1
- Removed free calls, incorporated at revision 1130.
- Avoid NULL dereference in parse_sdl_address as well.
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
@@ -1047,9 +1047,10 @@
ret = 1;
- out:
- CU_DEBUG("Exiting parse_console_address, ip is %s, port is %s",
- *path, *port);
+ out:
+ if (path && port)
+ CU_DEBUG("Exiting parse_console_address, ip is %s, port is
%s",
+ *path, *port);
free(tmp_path);
free(tmp_port);
@@ -1097,8 +1098,9 @@
ret = 1;
out:
- CU_DEBUG("Exiting parse_sdl_address, display is %s, xauth is %s",
- *display, *xauth);
+ if (display && xauth)
+ CU_DEBUG("Exiting parse_sdl_address, display is %s, xauth is
%s",
+ *display, *xauth);
free(tmp_display);
free(tmp_xauth);
@@ -1137,8 +1139,9 @@
ret = 1;
out:
- CU_DEBUG("Exiting parse_vnc_address, ip is %s, port is %s",
- *ip, *port);
+ if (ip && port)
+ CU_DEBUG("Exiting parse_vnc_address, ip is %s, port is %s",
+ *ip, *port);
free(tmp_ip);
free(tmp_port);