diff options
author | Jaroslav Kysela <perex@perex.cz> | 2021-01-08 18:21:39 +0100 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2021-01-08 18:21:39 +0100 |
commit | 90bbeb1d3ee892be97560c069b22ecab4bb2bf6a (patch) | |
tree | cbb0de47463a77fce87a712e5eead4a4c4d484a8 /alsaloop | |
parent | c5ecfd97894b429712d334eb91fa46e687b5ed0f (diff) | |
download | alsa-utils-90bbeb1d3ee892be97560c069b22ecab4bb2bf6a.tar.gz |
alsaloop: fix possible memory leak in create_loopback_handle()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'alsaloop')
-rw-r--r-- | alsaloop/alsaloop.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/alsaloop/alsaloop.c b/alsaloop/alsaloop.c index 6a9ce58..06ffadf 100644 --- a/alsaloop/alsaloop.c +++ b/alsaloop/alsaloop.c @@ -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; } |