Fix potential memory leak of rioWriteBulkStreamID().

This commit is contained in:
WuYunlong 2020-01-06 19:56:50 +08:00
parent 0af467d18f
commit 2f8134a7ff

View File

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