Skip to content

Commit

Permalink
Fix incorrect cache_memory reset in functionsLibCtxClear (valkey-io#1255
Browse files Browse the repository at this point in the history
)

functionsLibCtxClear should clear the provided lib_ctx parameter,
not the static variable curr_functions_lib_ctx, as this contradicts
the function's intended purpose.

The impact i guess is minor, like in some unhappy paths (diskless load
fails, function restore fails?), we will mess up the functions_caches
field, which is used in used_memory_functions / used_memory_scripts
fileds in INFO.

Signed-off-by: Binbin <[email protected]>
  • Loading branch information
enjoy-binbin authored Nov 7, 2024
1 parent 22bc49c commit 1c18c80
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void functionsLibCtxClear(functionsLibCtx *lib_ctx) {
stats->n_lib = 0;
}
dictReleaseIterator(iter);
curr_functions_lib_ctx->cache_memory = 0;
lib_ctx->cache_memory = 0;
}

void functionsLibCtxClearCurrent(int async) {
Expand Down

0 comments on commit 1c18c80

Please sign in to comment.