浏览代码

fix mallocng regression in malloc_usable_size with null argument

commit d1507646975cbf6c3e511ba07b193f27f032d108 added support for null
argument in oldmalloc and was overlooked when switching to mallocng.
Dominic Chen 4 年之前
父节点
当前提交
5d464f524b
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      src/malloc/mallocng/malloc_usable_size.c

+ 1 - 0
src/malloc/mallocng/malloc_usable_size.c

@@ -3,6 +3,7 @@
 
 size_t malloc_usable_size(void *p)
 {
+	if (!p) return 0;
 	struct meta *g = get_meta(p);
 	int idx = get_slot_index(p);
 	size_t stride = get_stride(g);