diff --git a/lib/ogg.cpp b/lib/ogg.cpp index 43d1ded7..0592d6e9 100644 --- a/lib/ogg.cpp +++ b/lib/ogg.cpp @@ -44,6 +44,12 @@ namespace OGG{ datasize = 0; dataSum = 0; } + + Page::~Page(){ + if (data){ + free(data); + } + } bool Page::read(std::string & newData){ segmentTableDeque.clear(); diff --git a/lib/ogg.h b/lib/ogg.h index b0abcf20..368adf5b 100644 --- a/lib/ogg.h +++ b/lib/ogg.h @@ -11,6 +11,7 @@ namespace OGG{ class Page{ public: Page(); + ~Page(); bool read(std::string & newData); long unsigned int getMagicNumber(); void setMagicNumber(); @@ -49,7 +50,7 @@ namespace OGG{ private: std::deque segmentTableDeque; char* data;//pointer to the beginning of the Page data - unsigned int datasize;//size of the complete page + unsigned int datasize;//size of the allocated memory unsigned int dataSum;//size of the total segments bool checkDataSize(unsigned int size); std::string codec;//codec in the page