Skip to content

Commit

Permalink
fix memory leakage of variable token
Browse files Browse the repository at this point in the history
  • Loading branch information
ccding committed Jan 20, 2013
1 parent e50cdbe commit 0097c27
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion deps/hiredis/sds.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,10 @@ sds *sdssplitlen(char *s, int len, char *sep, int seplen, int *count) {
#ifdef SDS_ABORT_ON_OOM
if (tokens == NULL) sdsOomAbort();
#endif
if (seplen < 1 || len < 0 || tokens == NULL) return NULL;
if (seplen < 1 || len < 0 || tokens == NULL) {
free(tokens);
return NULL;
}
if (len == 0) {
*count = 0;
return tokens;
Expand Down

0 comments on commit 0097c27

Please sign in to comment.