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

Victorien Le Couviour--Tuffet victorien.lecouviour.tuffet at gmail.com
Tue Apr 25 21:21:56 CEST 2017


---
remove goto

 src/video_output/video_output.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 8b48a1cc8a..3538729d87 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -714,14 +714,22 @@ static void ThreadChangeFilters(vout_thread_t *vout,
         char *next = config_ChainCreate(&name, &cfg, current);
 
         if (name && *name) {
-            vout_filter_t *e = xmalloc(sizeof(*e));
-            e->name = name;
-            e->cfg  = cfg;
-            if (!strcmp(e->name, "deinterlace") ||
-                !strcmp(e->name, "postproc")) {
-                vlc_array_append(&array_static, e);
-            } else {
-                vlc_array_append(&array_interactive, e);
+            vout_filter_t *e = malloc(sizeof(*e));
+
+            if (e) {
+                e->name = name;
+                e->cfg  = cfg;
+                if (!strcmp(e->name, "deinterlace") ||
+                    !strcmp(e->name, "postproc")) {
+                    vlc_array_append(&array_static, e);
+                } else {
+                    vlc_array_append(&array_interactive, e);
+                }
+            }
+            else {
+                if (cfg)
+                    config_ChainDestroy(cfg);
+                free(name);
             }
         } else {
             if (cfg)
-- 
2.12.0



More information about the vlc-devel mailing list