Fix incorrect size in aligned lockfree realloc
authorCampbell Barton <ideasman42@gmail.com>
Wed, 23 May 2018 05:24:57 +0000 (07:24 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 23 May 2018 05:24:57 +0000 (07:24 +0200)
Thanks to @alikendarfen for finding.

intern/guardedalloc/intern/mallocn_lockfree_impl.c

index 9575375d90aca71c2988da6a8952ec37c69d4444..d01ad6c8d7238297a6519cb3425f3234ba1e6838 100644 (file)
@@ -204,9 +204,9 @@ void *MEM_lockfree_reallocN_id(void *vmemh, size_t len, const char *str)
                else {
                        MemHeadAligned *memh_aligned = MEMHEAD_ALIGNED_FROM_PTR(vmemh);
                        newp = MEM_lockfree_mallocN_aligned(
-                               old_len,
-                               (size_t)memh_aligned->alignment,
-                               "realloc");
+                               len,
+                               (size_t)memh_aligned->alignment,
+                               "realloc");
                }
 
                if (newp) {
@@ -242,9 +242,10 @@ void *MEM_lockfree_recallocN_id(void *vmemh, size_t len, const char *str)
                }
                else {
                        MemHeadAligned *memh_aligned = MEMHEAD_ALIGNED_FROM_PTR(vmemh);
-                       newp = MEM_lockfree_mallocN_aligned(old_len,
-                                                           (size_t)memh_aligned->alignment,
-                                                           "recalloc");
+                       newp = MEM_lockfree_mallocN_aligned(
+                               len,
+                               (size_t)memh_aligned->alignment,
+                               "recalloc");
                }
 
                if (newp) {