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.
This commit is contained in:
antirez 2013-03-06 12:19:38 +01:00
parent 5cabae84e6
commit 4ea89e64c0

View File

@ -593,6 +593,7 @@ err:
sdsfree(vector[*argc]);
zfree(vector);
if (current) sdsfree(current);
*argc = 0;
return NULL;
}