mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-02-17 22:05:18 -05:00
- check the return value of malloc & co.
This commit is contained in:
parent
7e6569e300
commit
d91948db49
7 changed files with 42 additions and 0 deletions
|
|
@ -795,6 +795,8 @@ 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)
|
||||
return -ENOMEM;
|
||||
while (1) {
|
||||
err = ioctl(s, SIOCGIFCONF, &conf);
|
||||
if (err < 0) {
|
||||
|
|
@ -806,6 +808,8 @@ 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)
|
||||
return -ENOMEM;
|
||||
}
|
||||
numreqs = conf.ifc_len / sizeof(struct ifreq);
|
||||
for (i = 0; i < numreqs; ++i) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue