Skip to content

Commit c1165fb

Browse files
committed
Fix safe_malloc infinite recursion
1 parent 184a94d commit c1165fb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/func.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
void *safe_malloc(size_t size)
77
{
8-
void *mem = safe_malloc(size);
9-
if (!mem)
8+
void *const mem = malloc(size);
9+
if (size != 0 && !mem)
1010
fatal_error("Out of memory");
1111
return mem;
1212
}

0 commit comments

Comments
 (0)