diff options
author | WuYunlong <xzsyeb@126.com> | 2020-01-06 19:56:50 +0800 |
---|---|---|
committer | WuYunlong <xzsyeb@126.com> | 2020-01-06 19:58:13 +0800 |
commit | 2f8134a7ff9d3c435dad16a73bf96e3daa919a21 (patch) | |
tree | 8a61dfc65821fcf892fe42ef0af5d99cee813b20 | |
parent | 0af467d18f9d12b137af3b709c0af579c29d8414 (diff) | |
download | redis-2f8134a7ff9d3c435dad16a73bf96e3daa919a21.tar.gz |
Fix potential memory leak of rioWriteBulkStreamID().
-rw-r--r-- | src/aof.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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; } |