From c0ea7926c0bc0882093cf5018264d71de2df4c47 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Tue, 2 Jun 2020 00:24:15 +0200 Subject: [PATCH] upnpdescgen.c: error message when memory alloc fails --- miniupnpd/upnpdescgen.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/miniupnpd/upnpdescgen.c b/miniupnpd/upnpdescgen.c index dcc03b9..46110f2 100644 --- a/miniupnpd/upnpdescgen.c +++ b/miniupnpd/upnpdescgen.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "config.h" #ifdef ENABLE_EVENTS @@ -816,7 +817,10 @@ strcat_str(char * str, int * len, int * tmplen, const char * s2) newlen = *tmplen + s2len + 1; p = (char *)realloc(str, newlen); if(p == NULL) /* handle a failure of realloc() */ + { + syslog(LOG_ERR, "strcat_str: Failed to realloc %d bytes", newlen); return str; + } str = p; *tmplen = newlen; } @@ -840,6 +844,7 @@ strcat_char(char * str, int * len, int * tmplen, char c) p = (char *)realloc(str, *tmplen); if(p == NULL) /* handle a failure of realloc() */ { + syslog(LOG_ERR, "strcat_char: Failed to realloc %d bytes", *tmplen); *tmplen -= 256; return str; }