[vlc-commits] vaapi: use vlc_alloc helper

Thomas Guillem git at videolan.org
Sat Nov 11 19:00:16 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Sat Nov 11 18:48:20 2017 +0100| [28a0ab725cd66261528ee64f45a0094b2495559e] | committer: Thomas Guillem

vaapi: use vlc_alloc helper

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

 modules/hw/vaapi/chroma.c    | 2 +-
 modules/hw/vaapi/filters.c   | 2 +-
 modules/hw/vaapi/vlc_vaapi.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/hw/vaapi/chroma.c b/modules/hw/vaapi/chroma.c
index 891830e02e..166c241bde 100644
--- a/modules/hw/vaapi/chroma.c
+++ b/modules/hw/vaapi/chroma.c
@@ -54,7 +54,7 @@ static int CreateFallbackImage(filter_t *filter, picture_t *src_pic,
 {
     int count = vaMaxNumImageFormats(va_dpy);
 
-    VAImageFormat *fmts = malloc(count * sizeof (*fmts));
+    VAImageFormat *fmts = vlc_alloc(count, sizeof (*fmts));
     if (unlikely(fmts == NULL))
         return VLC_ENOMEM;
 
diff --git a/modules/hw/vaapi/filters.c b/modules/hw/vaapi/filters.c
index e68700bb82..c6bac6d14b 100755
--- a/modules/hw/vaapi/filters.c
+++ b/modules/hw/vaapi/filters.c
@@ -1110,7 +1110,7 @@ OpenDeinterlace_InitHistory(void * p_data, VAProcPipelineCaps const * pipeline_c
     if (history_sz - 1)
     {
         p_deint_data->forward_refs.surfaces =
-            malloc((history_sz - 1) * sizeof(VASurfaceID));
+            vlc_alloc(history_sz - 1, sizeof(VASurfaceID));
         if (!p_deint_data->forward_refs.surfaces)
             return VLC_ENOMEM;
     }
diff --git a/modules/hw/vaapi/vlc_vaapi.c b/modules/hw/vaapi/vlc_vaapi.c
index baae6f510f..b2d1f16e03 100644
--- a/modules/hw/vaapi/vlc_vaapi.c
+++ b/modules/hw/vaapi/vlc_vaapi.c
@@ -362,7 +362,7 @@ IsEntrypointAvailable(VADisplay dpy, VAProfile i_profile,
 
     if (num_entrypoints <= 0)
         return false;
-    entrypoints = malloc(num_entrypoints * sizeof(VAEntrypoint));
+    entrypoints = vlc_alloc(num_entrypoints, sizeof(VAEntrypoint));
 
     if (!entrypoints)
         return false;
@@ -438,7 +438,7 @@ vlc_vaapi_CreateConfigChecked(vlc_object_t *o, VADisplay dpy,
         != VA_STATUS_SUCCESS)
         goto error;
 
-    sattribs = malloc(num_sattribs * sizeof(*sattribs));
+    sattribs = vlc_alloc(num_sattribs, sizeof(*sattribs));
     if (sattribs == NULL)
         goto error;
     if (vaQuerySurfaceAttributes(dpy, va_config_id, sattribs, &num_sattribs)



More information about the vlc-commits mailing list