From cd76bb651ddc9168451e6729fdf7793eb628f57c Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Thu, 2 Sep 2010 14:19:15 +0200 Subject: [PATCH] Free the sds in addReplySds when it cannot be added to the reply --- src/networking.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/networking.c b/src/networking.c index d2a4e231..89613ced 100644 --- a/src/networking.c +++ b/src/networking.c @@ -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); -- 2.45.2