]> git.pld-linux.org Git - packages/busybox.git/blame - busybox-malloc.patch
- update for 1.0.0pre2
[packages/busybox.git] / busybox-malloc.patch
CommitLineData
cf06ea0d
MM
1Only in busybox-0.60.1+/libbb: tags
2diff -ur busybox-0.60.1/libbb/xfuncs.c busybox-0.60.1+/libbb/xfuncs.c
3--- busybox-0.60.1/libbb/xfuncs.c Thu Jun 28 23:22:19 2001
4+++ busybox-0.60.1+/libbb/xfuncs.c Sun Oct 28 15:56:08 2001
4c6ebd20 5@@ -35,7 +35,12 @@
88d94291
MM
6 #ifndef DMALLOC
7 extern void *xmalloc(size_t size)
8 {
9- void *ptr = malloc(size);
10+ void *ptr;
11+
12+ if (size == 0)
13+ size++;
14+
15+ ptr = malloc(size);
16
17 if (!ptr)
18 error_msg_and_die(memory_exhausted);
cf06ea0d
MM
19@@ -54,6 +59,9 @@
20 return NULL;
21 }
22
23+ if (size == 0)
24+ size++;
25+
26 ptr = realloc(old, size);
27 if (!ptr)
28 error_msg_and_die(memory_exhausted);
29@@ -62,9 +70,18 @@
30
31 extern void *xcalloc(size_t nmemb, size_t size)
32 {
33- void *ptr = calloc(nmemb, size);
34+ void *ptr;
35+
36+ if (nmemb == 0)
37+ nmemb++;
38+
39+ if (size == 0)
40+ size++;
41+
42+ ptr = calloc(nmemb, size);
43 if (!ptr)
44 error_msg_and_die(memory_exhausted);
45+
46 return ptr;
47 }
48
This page took 0.027435 seconds and 4 git commands to generate.