mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 00:35:42 +01:00
alsaloop: fix possible memory leak in create_loopback_handle()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
c5ecfd9789
commit
90bbeb1d3e
1 changed files with 7 additions and 2 deletions
|
@ -85,12 +85,17 @@ static int create_loopback_handle(struct loopback_handle **_handle,
|
||||||
if (device == NULL)
|
if (device == NULL)
|
||||||
device = "hw:0,0";
|
device = "hw:0,0";
|
||||||
handle->device = strdup(device);
|
handle->device = strdup(device);
|
||||||
if (handle->device == NULL)
|
if (handle->device == NULL) {
|
||||||
|
free(handle);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
}
|
||||||
if (ctldev) {
|
if (ctldev) {
|
||||||
handle->ctldev = strdup(ctldev);
|
handle->ctldev = strdup(ctldev);
|
||||||
if (handle->ctldev == NULL)
|
if (handle->ctldev == NULL) {
|
||||||
|
free(handle->device);
|
||||||
|
free(handle);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
handle->ctldev = NULL;
|
handle->ctldev = NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue