[vlc-commits] commit: Avcodec: Correctly free the Subtitles structures so it doesn' t crash on Win32 (Jean-Baptiste Kempf )

git at videolan.org git at videolan.org
Sat May 1 23:38:13 CEST 2010


vlc/vlc-1.1 | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sat May  1 23:29:45 2010 +0200| [cb290dc668f53356ca59160b770c85c0fb3797bb] | committer: Jean-Baptiste Kempf 

Avcodec: Correctly free the Subtitles structures so it doesn't crash on Win32

Close #3439
(cherry picked from commit 8900648846ab501c875638eab5763b41951c1e8c)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/codec/avcodec/subtitle.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/modules/codec/avcodec/subtitle.c b/modules/codec/avcodec/subtitle.c
index cea1767..dfb54ce 100644
--- a/modules/codec/avcodec/subtitle.c
+++ b/modules/codec/avcodec/subtitle.c
@@ -262,7 +262,7 @@ static subpicture_t *ConvertSubtitle(decoder_t *dec, AVSubtitle *ffsub, mtime_t
         //msg_Err(dec, "SUBS RECT[%d]: %dx%d @%dx%d",
         //         i, rec->w, rec->h, rec->x, rec->y);
 
-        subpicture_region_t *region;
+        subpicture_region_t *region = NULL;
         switch (ffsub->format) {
         case 0:
             region = ConvertRegionRGBA(rec);
@@ -276,13 +276,11 @@ static subpicture_t *ConvertSubtitle(decoder_t *dec, AVSubtitle *ffsub, mtime_t
             *region_next = region;
             region_next = &region->p_next;
         }
-        /* Free AVSubtitleRect
-         * FIXME isn't there an avcodec function ? */
-        free(rec->pict.data[0]); /* Plane */
-        free(rec->pict.data[1]); /* Palette */
-        free(rec);
+        /* Free AVSubtitleRect */
+        avpicture_free(&rec->pict);
+        av_free(rec);
     }
-    free(ffsub->rects);
+    av_free(ffsub->rects);
 
     return spu;
 }



More information about the vlc-commits mailing list