Also reorder the cleanup sequence in app_finalize().
}
app->npfds = snd_seq_poll_descriptors_count (app->seq, POLLIN);
- app->pfds = alloca (sizeof (*app->pfds) * app->npfds);
+ app->pfds = malloc (sizeof (*app->pfds) * app->npfds);
if (app->pfds == NULL) {
ret = -ENOMEM;
goto err_free_buffer;
app_finalize (App * app)
{
/* free the resources */
+ free (app->pfds);
free (app->buffer);
- free (app->ports);
snd_midi_event_free (app->parser);
+ free (app->ports);
snd_seq_close (app->seq);
}