Skip to content

Commit

Permalink
ASoC: dapm: using freed pointer in dapm_kcontrol_add_widget()
Browse files Browse the repository at this point in the history
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: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Dan Carpenter authored and Mark Brown committed Jul 31, 2013
1 parent 39eb5fd commit 46a02c9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,13 @@ static int dapm_kcontrol_add_widget(struct snd_kcontrol *kcontrol,

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

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

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

return 0;
}
Expand Down

0 comments on commit 46a02c9

Please sign in to comment.