Skip to content

Commit 45b7b98

Browse files
murphyjacob4ranshid
authored andcommitted
Free module context even if there was no content written in auxsave2 (#2132)
When a module saves to the Aux metadata with aux_save2 callback, the module context is not freed if the module didn't save anything in the callback. https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1277-L1284. Note that we return 0, however we should be doing the cleanup done on https://github.com/valkey-io/valkey/blob/8.1.1/src/rdb.c#L1300-L1303 still. Fixes #2125 Signed-off-by: Jacob Murphy <[email protected]>
1 parent 981763a commit 45b7b98

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/rdb.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,6 +1247,10 @@ ssize_t rdbSaveSingleModuleAux(rio *rdb, int when, moduleType *mt) {
12471247
* to allow loading this RDB if the module is not present. */
12481248
sdsfree(io.pre_flush_buffer);
12491249
io.pre_flush_buffer = NULL;
1250+
if (io.ctx) {
1251+
moduleFreeContext(io.ctx);
1252+
zfree(io.ctx);
1253+
}
12501254
return 0;
12511255
}
12521256
} else {

0 commit comments

Comments
 (0)