Modules: Invalidate saved_oparray after use (#7688)

We wanna avoid a chance of someone using the pointer in it after it'll be freed / realloced.
This commit is contained in:
guybe7 2020-08-20 18:55:14 +02:00 committed by GitHub
parent 5e6212e087
commit 4de17eb032

View File

@ -609,6 +609,8 @@ void moduleHandlePropagationAfterCommandCallback(RedisModuleCtx *ctx) {
redisOpArrayFree(&server.also_propagate); redisOpArrayFree(&server.also_propagate);
/* Restore the previous oparray in case of nexted use of the API. */ /* Restore the previous oparray in case of nexted use of the API. */
server.also_propagate = ctx->saved_oparray; server.also_propagate = ctx->saved_oparray;
/* We're done with saved_oparray, let's invalidate it. */
redisOpArrayInit(&ctx->saved_oparray);
} }
} }