summaryrefslogtreecommitdiff
path: root/src/functions.c
diff options
context:
space:
mode:
authorMeir Shpilraien (Spielrein) <meir@redis.com>2022-05-10 11:47:45 +0300
committerGitHub <noreply@github.com>2022-05-10 11:47:45 +0300
commit442e73ea092905cef8f25bf0ac883e90f0666e89 (patch)
treea2f5750d6d138cd78c539475fed0ae9d321fdd05 /src/functions.c
parenta3df2777e8e4c8a9af56bcc8b1587e0838466285 (diff)
downloadredis-442e73ea092905cef8f25bf0ac883e90f0666e89.tar.gz
Fix #10705, avoid relinking the same library twice. (#10706)
Set `old_li` to NULL to avoid linking it again on error. Before the fix, loading an already existing library will cause the existing library to be added again. This cause not harm other then wrong statistics. The statistics that are effected by the issue are: * `libraries_count` and `functions_count` returned by `function stats` command * `used_memory_functions` returned on `info memory` command * `functions.caches` returned on `memory stats` command
Diffstat (limited to 'src/functions.c')
-rw-r--r--src/functions.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/functions.c b/src/functions.c
index 19d0d0c11..c40761865 100644
--- a/src/functions.c
+++ b/src/functions.c
@@ -963,6 +963,7 @@ sds functionsCreateWithLibraryCtx(sds code, int replace, sds* err, functionsLibC
old_li = dictFetchValue(lib_ctx->libraries, md.name);
if (old_li && !replace) {
+ old_li = NULL;
*err = sdscatfmt(sdsempty(), "Library '%S' already exists", md.name);
goto error;
}