summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuYunlong <xzsyeb@126.com>2020-01-06 19:56:50 +0800
committerWuYunlong <xzsyeb@126.com>2020-01-06 19:58:13 +0800
commit2f8134a7ff9d3c435dad16a73bf96e3daa919a21 (patch)
tree8a61dfc65821fcf892fe42ef0af5d99cee813b20
parent0af467d18f9d12b137af3b709c0af579c29d8414 (diff)
downloadredis-2f8134a7ff9d3c435dad16a73bf96e3daa919a21.tar.gz
Fix potential memory leak of rioWriteBulkStreamID().
-rw-r--r--src/aof.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/aof.c b/src/aof.c
index 0ef59cfb6..102c39f3f 100644
--- a/src/aof.c
+++ b/src/aof.c
@@ -1139,7 +1139,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;
}