Commit 4ea89e64 authored by antirez's avatar antirez
Browse files

sdssplitargs(): on error set *argc to 0.

This makes programs not checking the return value for NULL much safer
since with this change:

1) It is still possible to iterate the zero-length result without
crashes.
2) sdssplitargs_free will work against NULL and 0 count.
parent 5cabae84
...@@ -593,6 +593,7 @@ err: ...@@ -593,6 +593,7 @@ err:
sdsfree(vector[*argc]); sdsfree(vector[*argc]);
zfree(vector); zfree(vector);
if (current) sdsfree(current); if (current) sdsfree(current);
*argc = 0;
return NULL; return NULL;
} }
......
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