From: Zidan Wang Date: Wed, 2 Dec 2015 03:02:12 +0000 (+0800) Subject: MLK-11942 ASoC: fsl_asrc_m2m: free pair after allocating m2m failed X-Git-Tag: C0P2-H0.0--20200415~3939 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=c78e3c009f808c0977617ef62c0bf32c8a5e18b1;p=linux.git MLK-11942 ASoC: fsl_asrc_m2m: free pair after allocating m2m failed free pair after allocating m2m failed. Reported by coverity. Signed-off-by: Zidan Wang (cherry picked from commit 237a35db5b48b78250a019f891d9d746c3411d49) --- diff --git a/sound/soc/fsl/fsl_asrc_m2m.c b/sound/soc/fsl/fsl_asrc_m2m.c index 8de37d46940d..0caed6233b6b 100644 --- a/sound/soc/fsl/fsl_asrc_m2m.c +++ b/sound/soc/fsl/fsl_asrc_m2m.c @@ -827,7 +827,8 @@ static int fsl_asrc_open(struct inode *inode, struct file *file) m2m = kzalloc(sizeof(struct fsl_asrc_m2m), GFP_KERNEL); if (!m2m) { dev_err(dev, "failed to allocate m2m resource\n"); - return -ENOMEM; + ret = -ENOMEM; + goto out; } pair->private = m2m; @@ -843,6 +844,10 @@ static int fsl_asrc_open(struct inode *inode, struct file *file) pm_runtime_get_sync(dev); return 0; +out: + kfree(pair); + + return ret; } static int fsl_asrc_close(struct inode *inode, struct file *file)