Skip to content

Commit 8fc37a0

Browse files
authored
Fix undefined behavior warning in UBSAN (#1709)
This casue this warning in the undefined-behaviour santitizer test: ``` adlist.c:63:25: runtime error: call to function sdsfree through pointer to incorrect function type 'void (*)(void *)' /home/runner/work/valkey/valkey/src/sds.c:205: note: sdsfree defined here SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior adlist.c:63:25 ``` Signed-off-by: Binbin <[email protected]>
1 parent 86469ab commit 8fc37a0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/eval.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void evalInit(void) {
101101
* and we need to free them respectively. */
102102
evalCtx.scripts = dictCreate(&shaScriptObjectDictType);
103103
evalCtx.scripts_lru_list = listCreate();
104-
listSetFreeMethod(evalCtx.scripts_lru_list, (void (*)(void *))sdsfree);
104+
listSetFreeMethod(evalCtx.scripts_lru_list, sdsfreeVoid);
105105
evalCtx.scripts_mem = 0;
106106
}
107107

src/lua/debug_lua.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void ldbInit(void) {
4747
ldb.conn = NULL;
4848
ldb.active = 0;
4949
ldb.logs = listCreate();
50-
listSetFreeMethod(ldb.logs, (void (*)(void *))sdsfree);
50+
listSetFreeMethod(ldb.logs, sdsfreeVoid);
5151
ldb.children = listCreate();
5252
ldb.src = NULL;
5353
ldb.lines = 0;

0 commit comments

Comments
 (0)