diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2011-08-20 18:30:28 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2011-08-20 18:30:28 +0200 |
commit | 35b2f0e44af1544253e0d1d5edaf5afe6d879f97 (patch) | |
tree | 75386860c59202494a9965fadc8c8483ac4fc89a /libshouldbeinlibc/localhost.c | |
parent | f4094214ebc8ef7c5e8140605bc17907b5672b13 (diff) |
Fix localhost() after memory failure
* libshouldbeinlibc/localhost.c (localhost): Free and reset buf when
reallocation failed.
Diffstat (limited to 'libshouldbeinlibc/localhost.c')
-rw-r--r-- | libshouldbeinlibc/localhost.c | 2 |
1 files changed, 2 insertions, 0 deletions
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; } |