From 2f8134a7ff9d3c435dad16a73bf96e3daa919a21 Mon Sep 17 00:00:00 2001 From: WuYunlong Date: Mon, 6 Jan 2020 19:56:50 +0800 Subject: Fix potential memory leak of rioWriteBulkStreamID(). --- src/aof.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/aof.c') 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; } -- cgit v1.2.1