From: Jaroslav Kysela Date: Fri, 8 Jan 2021 17:21:39 +0000 (+0100) Subject: alsaloop: fix possible memory leak in create_loopback_handle() X-Git-Tag: v1.2.5~91 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=90bbeb1d3ee892be97560c069b22ecab4bb2bf6a;p=alsa-utils.git alsaloop: fix possible memory leak in create_loopback_handle() Signed-off-by: Jaroslav Kysela --- 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; }