From bd0b008c0d8ff08cd541dc608ce78478de7c9d12 Mon Sep 17 00:00:00 2001 From: Renu Tyagi Date: Tue, 23 Sep 2014 09:06:36 +0200 Subject: [PATCH] socket: missing socket close Signed-off-by: renu tyagi Signed-off-by: Takashi Iwai --- src/socket.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/socket.c b/src/socket.c index 97c919f7..16979b52 100644 --- a/src/socket.c +++ b/src/socket.c @@ -124,12 +124,15 @@ int snd_is_local(struct hostent *hent) conf.ifc_len = numreqs * sizeof(struct ifreq); conf.ifc_buf = malloc((unsigned int) conf.ifc_len); - if (! conf.ifc_buf) + if (! conf.ifc_buf) { + close(s); return -ENOMEM; + } while (1) { err = ioctl(s, SIOCGIFCONF, &conf); if (err < 0) { SYSERR("SIOCGIFCONF failed"); + close(s); return -errno; } if ((size_t)conf.ifc_len < numreqs * sizeof(struct ifreq)) @@ -137,8 +140,10 @@ int snd_is_local(struct hostent *hent) numreqs *= 2; conf.ifc_len = numreqs * sizeof(struct ifreq); conf.ifc_buf = realloc(conf.ifc_buf, (unsigned int) conf.ifc_len); - if (! conf.ifc_buf) + if (! conf.ifc_buf) { + close(s); return -ENOMEM; + } } numreqs = conf.ifc_len / sizeof(struct ifreq); for (i = 0; i < numreqs; ++i) { -- 2.47.3