[vlc-devel] [PATCH 1/2] vout: remove xmalloc

Victorien Le Couviour--Tuffet victorien.lecouviour.tuffet at gmail.com
Tue Apr 25 20:40:11 CEST 2017


---
sry for sending this again, I just discovered '--in-reply-to' doesn't apply to all patches at once

skipping filter if its malloc fails

 src/video_output/video_output.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 8b48a1cc8a..e5b92a0711 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -714,7 +714,10 @@ static void ThreadChangeFilters(vout_thread_t *vout,
         char *next = config_ChainCreate(&name, &cfg, current);
 
         if (name && *name) {
-            vout_filter_t *e = xmalloc(sizeof(*e));
+            vout_filter_t *e = malloc(sizeof(*e));
+
+            if (!e)
+                goto filter_load_failure;
             e->name = name;
             e->cfg  = cfg;
             if (!strcmp(e->name, "deinterlace") ||
@@ -724,6 +727,7 @@ static void ThreadChangeFilters(vout_thread_t *vout,
                 vlc_array_append(&array_interactive, e);
             }
         } else {
+        filter_load_failure:
             if (cfg)
                 config_ChainDestroy(cfg);
             free(name);
-- 
2.12.0



More information about the vlc-devel mailing list