Fix potential memory leak of rioWriteBulkStreamID().

This commit is contained in:
WuYunlong
2020-01-17 10:47:38 +01:00
committed by antirez
parent ecd17e819c
commit cc90f79baf
+4 -1
View File
@@ -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;
}