]> Git Repo - linux.git/commitdiff
ASoC: core: fix possible memory leak in snd_soc_bytes_put()
authorWei Yongjun <[email protected]>
Mon, 11 Mar 2013 16:35:14 +0000 (00:35 +0800)
committerMark Brown <[email protected]>
Tue, 12 Mar 2013 18:42:59 +0000 (18:42 +0000)
'data' is malloced in snd_soc_bytes_put() and should be freed
before leaving from the error handling cases, otherwise it will cause
memory leak.

Signed-off-by: Wei Yongjun <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
sound/soc/soc-core.c

index b7e84a7cd9ee70451e453f9ef8febb23f3ad05ab..93341deaa4b9b565a8b2128cf0d7215b3c9eee30 100644 (file)
@@ -3140,7 +3140,7 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
        if (params->mask) {
                ret = regmap_read(codec->control_data, params->base, &val);
                if (ret != 0)
-                       return ret;
+                       goto out;
 
                val &= params->mask;
 
@@ -3158,13 +3158,15 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
                        ((u32 *)data)[0] |= cpu_to_be32(val);
                        break;
                default:
-                       return -EINVAL;
+                       ret = -EINVAL;
+                       goto out;
                }
        }
 
        ret = regmap_raw_write(codec->control_data, params->base,
                               data, len);
 
+out:
        kfree(data);
 
        return ret;
This page took 0.068009 seconds and 4 git commands to generate.