Discussion:
Little patch
David CARLIER
2016-01-26 15:39:47 UTC
Permalink
Hi all,

I just had a short chat with otto and would like to know if this little
patch would be considered. The reasoning is while debugging a program I got
a segmentation fault inside the loop as pool was NULL probably due to the
fact that malloc_init was not called first.

Thanks in advance.

Kind regards.

Index: malloc.c
===================================================================
RCS file: /cvs/src/lib/libc/stdlib/malloc.c,v
retrieving revision 1.176
diff -u -p -r1.176 malloc.c
--- malloc.c 13 Sep 2015 20:29:23 -0000 1.176
+++ malloc.c 26 Jan 2016 14:35:10 -0000
@@ -1844,6 +1844,8 @@ malloc_dump(int fd)
struct region_info *r;
int saved_errno = errno;

+ if (pool == NULL)
+ return;
for (i = 0; i < MALLOC_DELAYED_CHUNK_MASK + 1; i++) {
p = pool->delayed_chunks[i];
if (p == NULL)
David CARLIER
2016-01-26 15:47:19 UTC
Permalink
Nevermind otto yook care of it already :)
Post by David CARLIER
Hi all,
I just had a short chat with otto and would like to know if this little
patch would be considered. The reasoning is while debugging a program I got
a segmentation fault inside the loop as pool was NULL probably due to the
fact that malloc_init was not called first.
Thanks in advance.
Kind regards.
Index: malloc.c
===================================================================
RCS file: /cvs/src/lib/libc/stdlib/malloc.c,v
retrieving revision 1.176
diff -u -p -r1.176 malloc.c
--- malloc.c 13 Sep 2015 20:29:23 -0000 1.176
+++ malloc.c 26 Jan 2016 14:35:10 -0000
@@ -1844,6 +1844,8 @@ malloc_dump(int fd)
struct region_info *r;
int saved_errno = errno;
+ if (pool == NULL)
+ return;
for (i = 0; i < MALLOC_DELAYED_CHUNK_MASK + 1; i++) {
p = pool->delayed_chunks[i];
if (p == NULL)
Loading...