[vlc-commits] vmem: fix use of uninitialized memory

Rémi Denis-Courmont git at videolan.org
Sun Jul 21 11:13:33 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jul 21 12:13:13 2013 +0300| [806d4259d5f8a51e49837a60e76333902744ca4a] | committer: Rémi Denis-Courmont

vmem: fix use of uninitialized memory

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

 modules/video_output/vmem.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/video_output/vmem.c b/modules/video_output/vmem.c
index 72944c0..329d880 100644
--- a/modules/video_output/vmem.c
+++ b/modules/video_output/vmem.c
@@ -253,16 +253,16 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
     picture_t *pictures[count];
 
     for (unsigned i = 0; i < count; i++) {
-        picture_resource_t rsc;
-
-        rsc.p_sys = malloc(sizeof(*rsc.p_sys));
-        if (unlikely(!rsc.p_sys)) {
+        picture_sys_t *picsys = malloc(sizeof (*picsys));
+        if (unlikely(picsys == NULL))
+        {
             count = i;
             break;
         }
+        picsys->sys = sys;
+        picsys->id = NULL;
 
-        rsc.p_sys->sys = sys;
-        rsc.p_sys->id = NULL;
+        picture_resource_t rsc = { .p_sys = picsys };
 
         for (unsigned i = 0; i < PICTURE_PLANE_MAX; i++) {
             /* vmem-lock is responsible for the allocation */



More information about the vlc-commits mailing list