From 379ea8a545e7cd0a50f1132b9d53102bba3f78c2 Mon Sep 17 00:00:00 2001 From: Huang Zw Date: Thu, 28 Jan 2021 00:56:43 +0800 Subject: [PATCH] Fix bug in activeDefragSdsListAndDict dead code (#8403) In activeDefragSdsListAndDict when dict_val_type is DEFRAG_SDS_DICT_VAL_VOID_PTR, it should update de->v.val not ln->value. Because this code path will never be executed, so this bug never happened. --- src/defrag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/defrag.c b/src/defrag.c index e189deddd..db797711e 100644 --- a/src/defrag.c +++ b/src/defrag.c @@ -367,7 +367,7 @@ long activeDefragSdsListAndDict(list *l, dict *d, int dict_val_type) { } else if (dict_val_type == DEFRAG_SDS_DICT_VAL_VOID_PTR) { void *newptr, *ptr = dictGetVal(de); if ((newptr = activeDefragAlloc(ptr))) - ln->value = newptr, defragged++; + de->v.val = newptr, defragged++; } defragged += dictIterDefragEntry(di); }