summaryrefslogtreecommitdiff
path: root/src/aof.c
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2020-01-13 13:23:49 +0100
committerGitHub <noreply@github.com>2020-01-13 13:23:49 +0100
commit9506c860f6642bc14aa4079e991c1c298138044a (patch)
tree730ddefc5b554273d1e07ceb7b40c5e9fa0d7925 /src/aof.c
parentbaa88a1c144954469e3762023fb41617242dc30e (diff)
parentd6a13f444003e75e8ccbe97297bf32f0eb58cb23 (diff)
downloadredis-9506c860f6642bc14aa4079e991c1c298138044a.tar.gz
Merge pull request #6739 from trevor211/fixMemoryLeak
Fix potential memory leak of rioWriteBulkStreamID().
Diffstat (limited to 'src/aof.c')
-rw-r--r--src/aof.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/aof.c b/src/aof.c
index 63b34b43f..efdd68efa 100644
--- a/src/aof.c
+++ b/src/aof.c
@@ -1149,7 +1149,10 @@ int rioWriteBulkStreamID(rio *r,streamID *id) {
int retval;
sds replyid = sdscatfmt(sdsempty(),"%U-%U",id->ms,id->seq);
- if ((retval = rioWriteBulkString(r,replyid,sdslen(replyid))) == 0) return 0;
+ if ((retval = rioWriteBulkString(r,replyid,sdslen(replyid))) == 0) {
+ sdsfree(replyid);
+ return 0;
+ }
sdsfree(replyid);
return retval;
}