socket: missing socket close

Signed-off-by: renu tyagi <renu.tyagi@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Renu Tyagi 2014-09-23 09:06:36 +02:00 committed by Takashi Iwai
parent f3f568e3db
commit bd0b008c0d

View file

@ -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,9 +140,11 @@ 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) {
struct ifreq *req = &conf.ifc_req[i];