]> git.saurik.com Git - redis.git/blobdiff - src/networking.c
Free the sds in addReplySds when it cannot be added to the reply
[redis.git] / src / networking.c
index d2a4e231570f3c313a276e59d773b933af039af1..89613cedf5c8183c23caec05f5023e5e5bd57f48 100644 (file)
@@ -128,7 +128,11 @@ void addReply(redisClient *c, robj *obj) {
 }
 
 void addReplySds(redisClient *c, sds s) {
-    if (_ensureFileEvent(c) != REDIS_OK) return;
+    if (_ensureFileEvent(c) != REDIS_OK) {
+        /* The caller expects the sds to be free'd. */
+        sdsfree(s);
+        return;
+    }
     if (sdslen(s) < REDIS_REPLY_CHUNK_THRESHOLD) {
         _addReplyStringToBuffer(c,s,sdslen(s));
         sdsfree(s);