diff --git a/tests/modules/testrdb.c b/tests/modules/testrdb.c index 7c04bb4ef..3150b88e4 100644 --- a/tests/modules/testrdb.c +++ b/tests/modules/testrdb.c @@ -20,7 +20,8 @@ void *testrdb_type_load(RedisModuleIO *rdb, int encver) { long double ld = RedisModule_LoadLongDouble(rdb); if (RedisModule_IsIOError(rdb)) { RedisModuleCtx *ctx = RedisModule_GetContextFromIO(rdb); - RedisModule_FreeString(ctx, str); + if (str) + RedisModule_FreeString(ctx, str); return NULL; } /* Using the values only after checking for io errors. */