mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-09 17:15:43 +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)
|
||||
device = "hw:0,0";
|
||||
handle->device = strdup(device);
|
||||
if (handle->device == NULL)
|
||||
if (handle->device == NULL) {
|
||||
free(handle);
|
||||
return -ENOMEM;
|
||||
}
|
||||
if (ctldev) {
|
||||
handle->ctldev = strdup(ctldev);
|
||||
if (handle->ctldev == NULL)
|
||||
if (handle->ctldev == NULL) {
|
||||
free(handle->device);
|
||||
free(handle);
|
||||
return -ENOMEM;
|
||||
}
|
||||
} else {
|
||||
handle->ctldev = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue