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

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


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

vmem: fix use of uninitialized memory

(cherry picked from commit 806d4259d5f8a51e49837a60e76333902744ca4a)

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

 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