Skip to content

Commit 9cc5693

Browse files
committed
fix random segfault in strdup + malloc due to wrong allocation
1 parent 1cdb488 commit 9cc5693

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/commons/utils/include/pdc_malloc.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ void *PDC_free(void *mem);
7676
*/
7777
size_t PDC_get_global_mem_usage();
7878

79-
#define PDC_MALLOC(t) (t *)PDC_malloc(sizeof(t))
80-
#define PDC_CALLOC(c, t) (t *)PDC_calloc(c, sizeof(t))
79+
#define PDC_MALLOC(t) (t *)PDC_malloc(sizeof(t) + 1)
80+
#define PDC_CALLOC(c, t) (t *)PDC_calloc(c, sizeof(t) + 1)
8181

8282
#define PDC_FREE(t, obj) (t *)(intptr_t) PDC_free(obj)
8383

0 commit comments

Comments
 (0)