Skip to content

Commit

Permalink
ASoC: Free memory in the error paths of soc_of_parse_audio_routing()
Browse files Browse the repository at this point in the history
Release the memory of the routing table before leaving the function upon errors
in the device tree

Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Matthias Kaehlcke authored and Mark Brown committed Jul 11, 2012
1 parent 5c6af63 commit b761c0c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -4136,6 +4136,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
dev_err(card->dev,
"Property '%s' index %d could not be read: %d\n",
propname, 2 * i, ret);
kfree(routes);
return -EINVAL;
}
ret = of_property_read_string_index(np, propname,
Expand All @@ -4144,6 +4145,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
dev_err(card->dev,
"Property '%s' index %d could not be read: %d\n",
propname, (2 * i) + 1, ret);
kfree(routes);
return -EINVAL;
}
}
Expand Down

0 comments on commit b761c0c

Please sign in to comment.