[PATCH] VirtualSystemManagementService: Fixing potential null dereferences and leaks

# HG changeset patch # User Eduardo Lima (Etrunko) <eblima@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@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; }

Seems fine, +1 于 2011-8-11 3:53, Eduardo Lima (Etrunko) 写道:
# HG changeset patch # User Eduardo Lima (Etrunko)<eblima@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@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; }
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
-- Best Regards Wayne Xia mail:xiawenc@linux.vnet.ibm.com tel:86-010-82450803

+1 Sharad Mishra Open Virtualization Linux Technology Center IBM libvirt-cim-bounces@redhat.com wrote on 08/10/2011 10:08:29 PM:
Wayne Xia <xiawenc@linux.vnet.ibm.com> Sent by: libvirt-cim-bounces@redhat.com
08/10/11 10:08 PM
Please respond to List for discussion and development of libvirt CIM <libvirt-cim@redhat.com>
To
List for discussion and development of libvirt CIM <libvirt-cim@redhat.com>
cc
Subject
Re: [Libvirt-cim] [PATCH] VirtualSystemManagementService: Fixing potential null dereferences and leaks
Seems fine, +1
于 2011-8-11 3:53, Eduardo Lima (Etrunko) 写道:
# HG changeset patch # User Eduardo Lima (Etrunko)<eblima@br.ibm.com> # Date 1312918075 10800 # Node ID 8759e60c17c42101118f914215d071138340c70f # Parent 0291fb05e93a0cbcbf2b80c894a47d58f7c37d23 VirtualSystemManagementService: Fixing potential null dereferencesand 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@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; }
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
-- Best Regards
Wayne Xia mail:xiawenc@linux.vnet.ibm.com tel:86-010-82450803
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
participants (3)
-
Eduardo Lima (Etrunko)
-
Sharad Mishra
-
Wayne Xia