From 35b2f0e44af1544253e0d1d5edaf5afe6d879f97 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 20 Aug 2011 18:30:28 +0200 Subject: Fix localhost() after memory failure * libshouldbeinlibc/localhost.c (localhost): Free and reset buf when reallocation failed. --- libshouldbeinlibc/localhost.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libshouldbeinlibc/localhost.c') diff --git a/libshouldbeinlibc/localhost.c b/libshouldbeinlibc/localhost.c index f21f970d..f0225116 100644 --- a/libshouldbeinlibc/localhost.c +++ b/libshouldbeinlibc/localhost.c @@ -44,6 +44,8 @@ localhost () new = realloc (buf, buf_len); if (! new) { + free (buf); + buf = 0; errno = ENOMEM; return 0; } -- cgit v1.2.3