Fix potential memory leak of rioWriteBulkStreamID().

This commit is contained in:
WuYunlong 2020-01-06 19:56:50 +08:00 committed by antirez
parent ecd17e819c
commit cc90f79baf

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;
}