diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2010-04-30 07:00:58 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2010-04-30 07:00:58 +0000 |
commit | 000e6ad3dea9fe04759c7d27ea9ae500eccdc4bc (patch) | |
tree | a8afaa98c8beab93ea2d383fba9b01ed6821946e /beos | |
parent | b579b0deb39c067f19bebcb4acfb29d7ef87f258 (diff) | |
download | netsurf-000e6ad3dea9fe04759c7d27ea9ae500eccdc4bc.tar.gz netsurf-000e6ad3dea9fe04759c7d27ea9ae500eccdc4bc.tar.bz2 |
It turns out that realloc(ptr, 0) --> free(ptr) is not actually required by the C standard (whereas realloc(NULL, size) --> malloc(size) is).
Therefore, explicitly model the behaviour expected by our libraries (that realloc of 0 size is equivalent to free).
svn path=/trunk/netsurf/; revision=10524
Diffstat (limited to 'beos')
-rw-r--r-- | beos/beos_gui.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/beos/beos_gui.cpp b/beos/beos_gui.cpp index cb41dfa07..471f4e9ea 100644 --- a/beos/beos_gui.cpp +++ b/beos/beos_gui.cpp @@ -1170,6 +1170,11 @@ bool cookies_update(const char *domain, const struct cookie_data *data) static void *myrealloc(void *ptr, size_t len, void *pw) { + if (len == 0) { + free(ptr); + return NULL; + } + return realloc(ptr, len); } |