From 9f7e5fde8b002efb97504ee9a4eb464fce4072ed Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Tue, 9 Jun 2015 23:21:08 +0200 Subject: [PATCH] Do not use alloca() in app_init(): the memory is used after the return Also reorder the cleanup sequence in app_finalize(). --- gst-aseq-appsrc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gst-aseq-appsrc.c b/gst-aseq-appsrc.c index b4f6c39..7d4a885 100644 --- a/gst-aseq-appsrc.c +++ b/gst-aseq-appsrc.c @@ -347,7 +347,7 @@ app_init (App * app, char *ports) } 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; @@ -371,9 +371,10 @@ static void 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); } -- 2.1.4