Hello.
The problem is that realloc(p,0) returns NULL, which I have not
been expected. But it is a valid behaviour according to POSIX.
http://www.opengroup.org/onlinepubs/9699919799/functions/realloc.html
I tested previously only smartctl, which worked fine.
Axel, please, could you verify, whether patch bellow fixes it for you ?
Thanks
Petr
--- os_freebsd.cpp
+++ os_freebsd.cpp
@@ -164,7 +164,15 @@
#ifdef __GLIBC__
static inline void * reallocf(void *ptr, size_t size) {
- void *rv = realloc(ptr, size);
+ void *rv;
+
+ if (size == 0)
+ {
+ free(ptr);
+ return NULL;
+ }
+
+ rv = realloc(ptr, size);
if(rv == NULL)
free(ptr);
return rv;
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]