From: Roy Marples Date: Mon, 21 Jul 2014 19:08:22 +0000 (+0000) Subject: Use realloc instead of free/malloc. X-Git-Tag: v6.4.3~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=967db5951d0257f8cfc9f8a256dbc118c2145121;p=thirdparty%2Fdhcpcd.git Use realloc instead of free/malloc. --- diff --git a/if-options.c b/if-options.c index 6fa4b12b..4e921ba8 100644 --- a/if-options.c +++ b/if-options.c @@ -2062,11 +2062,11 @@ read_config(struct dhcpcd_ctx *ctx, for (e = dhcpcd_embedded_conf; *e; e++) { ol = strlen(*e) + 1; if (ol > buflen) { - free(buf); buflen = ol; - buf = malloc(buflen); + buf = realloc(buf, buflen); if (buf == NULL) { syslog(LOG_ERR, "%s: %m", __func__); + free(buf); return NULL; } }