[vlc-commits] vout: remove xmalloc

Victorien Le Couviour--Tuffet git at videolan.org
Fri Apr 28 09:20:23 CEST 2017


vlc | branch: master | Victorien Le Couviour--Tuffet <victorien.lecouviour.tuffet at gmail.com> | Tue Apr 25 21:21:56 2017 +0200| [e760b6486c5aaeb2954383f8d0ef1521c22e55eb] | committer: Thomas Guillem

vout: remove xmalloc

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e760b6486c5aaeb2954383f8d0ef1521c22e55eb
---

 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)



More information about the vlc-commits mailing list