From 2b36950e9b2e7c02363c965fd721d103d1dfab4a Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 6 Jul 2017 11:20:49 +0200 Subject: [PATCH] Free IO context if any in RDB loading code. Thanks to @oranagra for spotting this bug. --- src/rdb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/rdb.c b/src/rdb.c index 18acb419..1341942c 100644 --- a/src/rdb.c +++ b/src/rdb.c @@ -1415,6 +1415,10 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) { /* Call the rdb_load method of the module providing the 10 bit * encoding version in the lower 10 bits of the module ID. */ void *ptr = mt->rdb_load(&io,moduleid&1023); + if (io.ctx) { + moduleFreeContext(io.ctx); + zfree(io.ctx); + } /* Module v2 serialization has an EOF mark at the end. */ if (io.ver == 2) {