[PATCH 02/16] FSWrap: fix potential leak in copy_string_list
Ander Conselvan de Oliveira
ander.conselvan-de-oliveira at nokia.com
Wed Mar 30 06:11:55 PDT 2011
If list_count is 0, dst would be allocated and leaked.
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira at nokia.com>
---
src/FSWrap.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
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);
--
1.7.0.4
More information about the xorg-devel
mailing list