[02/16] FSWrap: fix potential leak in copy_string_list

Submitted by Ander Conselvan de Oliveira on March 30, 2011, 8:11 p.m.

Details

Message ID 1301490729-22084-3-git-send-email-ander.conselvan-de-oliveira@nokia.com
State Accepted, archived
Commit 396e5a452a59c1f121220ba72167b720a863b30f
Headers show

Not browsing as part of any series.

Commit Message

Ander Conselvan de Oliveira March 30, 2011, 8:11 p.m.
If list_count is 0, dst would be allocated and leaked.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>
---
 src/FSWrap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/FSWrap.c b/src/FSWrap.c
index a947093..94d94fb 100644
--- a/src/FSWrap.c
+++ b/src/FSWrap.c
@@ -131,7 +131,7 @@  copy_string_list(
     char **string_list_ret, **list_src, **list_dst, *dst;
     int length, count;
 
-    if (string_list == NULL)
+    if (string_list == NULL || list_count == 0)
 	return (char **) NULL;
 
     string_list_ret = (char **) Xmalloc(sizeof(char *) * list_count);