On Wed, 10 Mar 2021 07:34:26 +0100, zuoqilin1@163.com wrote:
From: zuoqilin zuoqilin@yulong.com
If kzalloc fail,not need free it,so just return -ENOMEM when kzalloc fail.
No, this check is performed after two kzalloc calls, so one might remain if you return immediately there.
thanks,
Takashi
Signed-off-by: zuoqilin zuoqilin@yulong.com
sound/core/oss/mixer_oss.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index bec9283..eec61dc 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c @@ -800,8 +800,7 @@ static int snd_mixer_oss_get_recsrc2(struct snd_mixer_oss_file *fmixer, unsigned uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); if (uinfo == NULL || uctl == NULL) {
err = -ENOMEM;
goto __free_only;
} down_read(&card->controls_rwsem); kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0);return -ENOMEM;
@@ -851,8 +850,7 @@ static int snd_mixer_oss_put_recsrc2(struct snd_mixer_oss_file *fmixer, unsigned uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); if (uinfo == NULL || uctl == NULL) {
err = -ENOMEM;
goto __free_only;
} down_read(&card->controls_rwsem); kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0);return -ENOMEM;
-- 1.9.1