diff options
author | WuYunlong <xzsyeb@126.com> | 2020-01-06 19:56:50 +0800 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2020-03-05 16:26:43 +0100 |
commit | 8ee3bddfc7792a8805a9da9eab9bba848a2b066b (patch) | |
tree | edfa8240ec9e4f7313d86b0e37ce08b75a71d9cb | |
parent | 4780fe78ba611104475561bdcc8ac29dfb22676d (diff) | |
download | redis-8ee3bddfc7792a8805a9da9eab9bba848a2b066b.tar.gz |
Fix potential memory leak of rioWriteBulkStreamID().
-rw-r--r-- | src/aof.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1127,7 +1127,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; } |