Commit e30c96eb authored by NanXiao's avatar NanXiao Committed by Matt Stancliff
Browse files

Add empty pointer check in error cleanup

If realloc fails, the curargv will be NULL.

Closes #253
parent d1e820d8
...@@ -895,11 +895,12 @@ int redisvFormatCommand(char **target, const char *format, va_list ap) { ...@@ -895,11 +895,12 @@ int redisvFormatCommand(char **target, const char *format, va_list ap) {
return totlen; return totlen;
err: err:
if (curargv) {
while(argc--) while(argc--)
sdsfree(curargv[argc]); sdsfree(curargv[argc]);
free(curargv); free(curargv);
}
if (curarg != NULL)
sdsfree(curarg); sdsfree(curarg);
/* No need to check cmd since it is the last statement that can fail, /* No need to check cmd since it is the last statement that can fail,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment