From 3469c86fdaecb5df95391d1e2153739650fb3b21 Mon Sep 17 00:00:00 2001 From: mark carter Date: Sat, 4 Aug 2007 16:29:21 +0100 Subject: [PATCH] Fixed initialisation of tf in file_open(). Without setting the memory to 0, tf->vpage has a pointer to random memory which causes problems for free(). --- cinelerra/fileogg.C | 13 +++++++++---- cinelerra/fileogg.h | 7 ++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/cinelerra/fileogg.C b/cinelerra/fileogg.C index 804ea70b..559af03e 100644 --- a/cinelerra/fileogg.C +++ b/cinelerra/fileogg.C @@ -1,3 +1,7 @@ +/* + 04-aug-2007 mcarter open_file() fixed allocation of tf +*/ + #include "asset.h" #include "bcsignals.h" #include "byteorder.h" @@ -29,7 +33,7 @@ #define READ_SIZE 66000 -/* This code was aspired by ffmpeg2theora */ +/* This code was inspired by ffmpeg2theora */ /* Special thanks for help on this code goes out to j@v2v.cc */ @@ -202,9 +206,10 @@ int FileOGG::open_file(int rd, int wr) this->wr = wr; if (!tf) { - tf = new theoraframes_info_t; - tf->audiosync = 0; - tf->videosync = 0; + size_t s; + s = sizeof(theoraframes_info_s); + tf = (theoraframes_info_t *) malloc(s); + memset(tf, 0, s); } diff --git a/cinelerra/fileogg.h b/cinelerra/fileogg.h index 65b2adf0..7ea17ceb 100644 --- a/cinelerra/fileogg.h +++ b/cinelerra/fileogg.h @@ -24,7 +24,7 @@ typedef struct int wlen; } sync_window_t; -typedef struct +struct theoraframes_info_s { ogg_page audiopage; ogg_page videopage; @@ -70,8 +70,9 @@ typedef struct int v_pkg; int a_pkg; -} -theoraframes_info_t; +}; + +typedef struct theoraframes_info_s theoraframes_info_t; class FileOGG : public FileBase { -- 2.11.4.GIT