Mem leak fixed

This commit is contained in:
Oswald Auguste de Bruin 2013-09-03 09:53:27 +02:00
parent 31ad924b46
commit c373136679
2 changed files with 8 additions and 1 deletions

View file

@ -45,6 +45,12 @@ namespace OGG{
dataSum = 0; dataSum = 0;
} }
Page::~Page(){
if (data){
free(data);
}
}
bool Page::read(std::string & newData){ bool Page::read(std::string & newData){
segmentTableDeque.clear(); segmentTableDeque.clear();
//datasize = 0; //datasize = 0;

View file

@ -11,6 +11,7 @@ namespace OGG{
class Page{ class Page{
public: public:
Page(); Page();
~Page();
bool read(std::string & newData); bool read(std::string & newData);
long unsigned int getMagicNumber(); long unsigned int getMagicNumber();
void setMagicNumber(); void setMagicNumber();
@ -49,7 +50,7 @@ namespace OGG{
private: private:
std::deque<unsigned int> segmentTableDeque; std::deque<unsigned int> segmentTableDeque;
char* data;//pointer to the beginning of the Page data 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 unsigned int dataSum;//size of the total segments
bool checkDataSize(unsigned int size); bool checkDataSize(unsigned int size);
std::string codec;//codec in the page std::string codec;//codec in the page