From 000e6ad3dea9fe04759c7d27ea9ae500eccdc4bc Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Fri, 30 Apr 2010 07:00:58 +0000 Subject: 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 --- gtk/gtk_gui.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gtk') diff --git a/gtk/gtk_gui.c b/gtk/gtk_gui.c index 3a749c67e..724c59c7d 100644 --- a/gtk/gtk_gui.c +++ b/gtk/gtk_gui.c @@ -537,6 +537,11 @@ void nsgtk_check_homedir(void) */ void *nsgtk_hubbub_realloc(void *ptr, size_t len, void *pw) { + if (len == 0) { + free(ptr); + return NULL; + } + return realloc(ptr, len); } -- cgit v1.2.3