[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:32:54 CEST 2010


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

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

Close #3439

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

 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 4a5e2cc..8b47448 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