summaryrefslogtreecommitdiff
path: root/src/sds.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2013-03-06 12:19:38 +0100
committerantirez <antirez@gmail.com>2013-03-06 12:21:31 +0100
commit4ea89e64c03e33ef9f1f2b338fa654f15e5a7f52 (patch)
tree2840a06fcd5421394eb97089c70f979e0d611ec1 /src/sds.c
parent5cabae84e60fa4b9ae0de00984ad0e9c08190532 (diff)
downloadredis-4ea89e64c03e33ef9f1f2b338fa654f15e5a7f52.tar.gz
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.
Diffstat (limited to 'src/sds.c')
-rw-r--r--src/sds.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/sds.c b/src/sds.c
index 74fb274ac..7d1227e71 100644
--- a/src/sds.c
+++ b/src/sds.c
@@ -593,6 +593,7 @@ err:
sdsfree(vector[*argc]);
zfree(vector);
if (current) sdsfree(current);
+ *argc = 0;
return NULL;
}