Skip to content
Browse files

Fixed memory leak in SORT LIMIT option argument parsing on error.

  • Loading branch information...
1 parent ef5e7fb commit 8caecc9ab466011fd1432c0a7e2dc51ae8797629 @antirez committed Mar 10, 2014
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/sort.c
View
11 src/sort.c
@@ -231,8 +231,15 @@ void sortCommand(redisClient *c) {
} else if (!strcasecmp(c->argv[j]->ptr,"alpha")) {
alpha = 1;
} else if (!strcasecmp(c->argv[j]->ptr,"limit") && leftargs >= 2) {
- if ((getLongFromObjectOrReply(c, c->argv[j+1], &limit_start, NULL) != REDIS_OK) ||
- (getLongFromObjectOrReply(c, c->argv[j+2], &limit_count, NULL) != REDIS_OK)) return;
+ if ((getLongFromObjectOrReply(c, c->argv[j+1], &limit_start, NULL)
+ != REDIS_OK) ||
+ (getLongFromObjectOrReply(c, c->argv[j+2], &limit_count, NULL)
+ != REDIS_OK))
+ {
+ decrRefCount(sortval);
+ listRelease(operations);
+ return;
+ }
j+=2;
} else if (!strcasecmp(c->argv[j]->ptr,"store") && leftargs >= 1) {
storekey = c->argv[j+1];

0 comments on commit 8caecc9

Please sign in to comment.
Something went wrong with that request. Please try again.