From 547b0a98505724e0b6e224baf7a11d9ca069a851 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 16 Feb 2013 13:17:43 -0800 Subject: [PATCH] Fix warning about realloc in xdgmimemagic --- xdgmimemagic.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xdgmimemagic.cpp b/xdgmimemagic.cpp index b4f9e14d9..3f67b2906 100644 --- a/xdgmimemagic.cpp +++ b/xdgmimemagic.cpp @@ -183,7 +183,13 @@ _xdg_mime_magic_read_to_newline(FILE *magic_file, if (pos % 128 == 127) { len = len + 128; - retval = (char *)realloc(retval, len); + char *tmp = (char *)realloc(retval, len); + if (tmp == NULL) + { + free(retval); + return NULL; + } + retval = tmp; } }