ALSA: synth: emux: soundfont.c: Cleaning up memory leak
authorRickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Sun, 1 Jun 2014 11:35:24 +0000 (13:35 +0200)
committerTakashi Iwai <tiwai@suse.de>
Sun, 1 Jun 2014 12:33:09 +0000 (14:33 +0200)
There is a risk for memory leak in when something unexpected happens
and the function returns.

This was largely found by using a static code analysis program called cppcheck.

[fixed a typo of kfree() by tiwai]

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/synth/emux/soundfont.c

index 1137b85..78683b2 100644 (file)
@@ -1021,6 +1021,7 @@ load_guspatch(struct snd_sf_list *sflist, const char __user *data,
                         data, count);
                if (rc < 0) {
                        sf_sample_delete(sflist, sf, smp);
+                       kfree(zone);
                        return rc;
                }
                /* memory offset is updated after */