Skip to content

Commit 80bbbcf

Browse files
authored
Fix memory leak in deferred reply buffer (#2615)
Set free method for deferred_reply list to properly clean up ClientReplyValue objects when the list is destroyed Signed-off-by: Uri Yagelnik <[email protected]>
1 parent 73d5b0e commit 80bbbcf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/networking.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1557,7 +1557,10 @@ inline int isDeferredReplyEnabled(client *c) {
15571557
* callback. */
15581558
void initDeferredReplyBuffer(client *c) {
15591559
if (moduleNotifyKeyspaceSubscribersCnt() == 0) return;
1560-
if (c->deferred_reply == NULL) c->deferred_reply = listCreate();
1560+
if (c->deferred_reply == NULL) {
1561+
c->deferred_reply = listCreate();
1562+
listSetFreeMethod(c->deferred_reply, freeClientReplyValue);
1563+
}
15611564
if (!isDeferredReplyEnabled(c)) c->deferred_reply_bytes = 0;
15621565
}
15631566

0 commit comments

Comments
 (0)