Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#3 realloc(NULL, size) doesn't work.

closed
nobody
None
5
2012-07-25
2001-08-19
Anonymous
No

Under the new glibc used by Debian unstable, dlopen
will in some cases allocate memory using realloc(NULL,
size). This is not handled by the malloc-emulation
code in ecls. This made it impossible to build ecls
for me without the following patch.

Since ecls probably doesn't use realloc(NULL, size),
I've put the if-test at the end of realloc to avoid
cluttering the normal case.

diff -u -r1.5 alloc.d
--- src/c/alloc.d 2001/08/18 10:55:10 1.5
+++ src/c/alloc.d 2001/08/19 22:02:01
@@ -852,7 +852,10 @@
return(x->string.self);
}
}
- FEerror("realloc(3) error.", 0);
+ if (ptr == NULL) {
+ return malloc(size);
+ }
+ FEerror("realloc(3) error.", 0);
}

Discussion


Anonymous


Cancel   Add attachments