From 0b7f9d4931540009532d338ddbec29c9a74c7cae Mon Sep 17 00:00:00 2001 From: Zhang Zhaolong Date: Wed, 11 Mar 2015 12:26:04 +0800 Subject: [PATCH] cmdline: fix incorrect usage of realloc. Signed-off-by: Zhang Zhaolong --- client/common/cmdline.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/common/cmdline.c b/client/common/cmdline.c index d69b7a8d3..abdfe4662 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -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)++;