cmdline: fix incorrect usage of realloc.
authorZhang Zhaolong <zhangzl2013@126.com>
Wed, 11 Mar 2015 04:26:04 +0000 (12:26 +0800)
committerZhang Zhaolong <zhangzl2013@126.com>
Wed, 11 Mar 2015 04:26:04 +0000 (12:26 +0800)
Signed-off-by: Zhang Zhaolong <zhangzl2013@126.com>
client/common/cmdline.c

index d69b7a8..abdfe46 100644 (file)
@@ -544,10 +544,17 @@ static char** freerdp_command_line_parse_comma_separated_values(char* list, int*
 static char** freerdp_command_line_parse_comma_separated_values_offset(char* list, int* count)
 {
        char** p;
+       char** t;
+       int s;
 
        p = freerdp_command_line_parse_comma_separated_values(list, count);
+       if (!p)
+               return NULL;
 
-       p = (char**) realloc(p, sizeof(char*) * (*count + 1));
+       t = (char**) realloc(p, sizeof(char*) * (*count + 1));
+       if (!t)
+               return NULL;
+       p = t;
        MoveMemory(&p[1], p, sizeof(char*) * *count);
        (*count)++;