mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-03 09:01:52 -05:00
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:
parent
f3f568e3db
commit
bd0b008c0d
1 changed files with 7 additions and 2 deletions
|
|
@ -124,12 +124,15 @@ int snd_is_local(struct hostent *hent)
|
||||||
|
|
||||||
conf.ifc_len = numreqs * sizeof(struct ifreq);
|
conf.ifc_len = numreqs * sizeof(struct ifreq);
|
||||||
conf.ifc_buf = malloc((unsigned int) conf.ifc_len);
|
conf.ifc_buf = malloc((unsigned int) conf.ifc_len);
|
||||||
if (! conf.ifc_buf)
|
if (! conf.ifc_buf) {
|
||||||
|
close(s);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
}
|
||||||
while (1) {
|
while (1) {
|
||||||
err = ioctl(s, SIOCGIFCONF, &conf);
|
err = ioctl(s, SIOCGIFCONF, &conf);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
SYSERR("SIOCGIFCONF failed");
|
SYSERR("SIOCGIFCONF failed");
|
||||||
|
close(s);
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
if ((size_t)conf.ifc_len < numreqs * sizeof(struct ifreq))
|
if ((size_t)conf.ifc_len < numreqs * sizeof(struct ifreq))
|
||||||
|
|
@ -137,8 +140,10 @@ int snd_is_local(struct hostent *hent)
|
||||||
numreqs *= 2;
|
numreqs *= 2;
|
||||||
conf.ifc_len = numreqs * sizeof(struct ifreq);
|
conf.ifc_len = numreqs * sizeof(struct ifreq);
|
||||||
conf.ifc_buf = realloc(conf.ifc_buf, (unsigned int) conf.ifc_len);
|
conf.ifc_buf = realloc(conf.ifc_buf, (unsigned int) conf.ifc_len);
|
||||||
if (! conf.ifc_buf)
|
if (! conf.ifc_buf) {
|
||||||
|
close(s);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
numreqs = conf.ifc_len / sizeof(struct ifreq);
|
numreqs = conf.ifc_len / sizeof(struct ifreq);
|
||||||
for (i = 0; i < numreqs; ++i) {
|
for (i = 0; i < numreqs; ++i) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue