Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 46a02c97 authored by Dan Carpenter's avatar Dan Carpenter Committed by Mark Brown
Browse files

ASoC: dapm: using freed pointer in dapm_kcontrol_add_widget()



There is a typo here so we end up using the old freed pointer instead of
the newly allocated one.  (If the "n" is zero then the code works,
obviously).

Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 39eb5fd1
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -225,13 +225,13 @@ static int dapm_kcontrol_add_widget(struct snd_kcontrol *kcontrol,


	new_data = krealloc(data, sizeof(*data) + sizeof(widget) * n,
	new_data = krealloc(data, sizeof(*data) + sizeof(widget) * n,
		GFP_KERNEL);
		GFP_KERNEL);
	if (!data)
	if (!new_data)
		return -ENOMEM;
		return -ENOMEM;


	data->wlist.widgets[n - 1] = widget;
	new_data->wlist.widgets[n - 1] = widget;
	data->wlist.num_widgets = n;
	new_data->wlist.num_widgets = n;


	kcontrol->private_data = data;
	kcontrol->private_data = new_data;


	return 0;
	return 0;
}
}