]> granicus.if.org Git - esp-idf/commitdiff
heap_trace: fix bug in realloc for copying trace record
authorMahavir Jain <mahavir@espressif.com>
Thu, 7 Dec 2017 12:49:40 +0000 (18:19 +0530)
committerMahavir Jain <mahavir@espressif.com>
Thu, 7 Dec 2017 12:50:23 +0000 (18:20 +0530)
Closes https://github.com/espressif/esp-idf/issues/1354

Signed-off-by: Mahavir Jain <mahavir@espressif.com>
components/heap/heap_trace.c

index b1da4415e0a727be0c5446cb486dd6d3ac069e86..b7ef48514e71d264fc3c2d2b58896d5cb3039306 100644 (file)
@@ -373,11 +373,11 @@ static IRAM_ATTR __attribute__((noinline)) void *trace_realloc(void *p, size_t s
             record_free(p, callers);
         }
         heap_trace_record_t rec = {
-            .address = p,
+            .address = r,
             .ccount = ccount,
             .size = size,
         };
-        memcpy(rec.alloced_by, callers, sizeof(heap_trace_record_t) * STACK_DEPTH);
+        memcpy(rec.alloced_by, callers, sizeof(void *) * STACK_DEPTH);
         record_allocation(&rec);
     }
     return r;