Fixed memory leak in MP4 library.
This commit is contained in:
		
							parent
							
								
									1e7766701d
								
							
						
					
					
						commit
						7822e5c75d
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
					@ -41,6 +41,10 @@ namespace MP4 {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Box & Box::operator = (const Box & rs) {
 | 
					  Box & Box::operator = (const Box & rs) {
 | 
				
			||||||
    clear();
 | 
					    clear();
 | 
				
			||||||
 | 
					    if (data) {
 | 
				
			||||||
 | 
					      free(data);
 | 
				
			||||||
 | 
					      data = 0;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    data = rs.data;
 | 
					    data = rs.data;
 | 
				
			||||||
    managed = false;
 | 
					    managed = false;
 | 
				
			||||||
    payloadOffset = rs.payloadOffset;
 | 
					    payloadOffset = rs.payloadOffset;
 | 
				
			||||||
| 
						 | 
					@ -55,7 +59,7 @@ namespace MP4 {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /// If managed, this will free the data pointer.
 | 
					  /// If managed, this will free the data pointer.
 | 
				
			||||||
  Box::~Box() {
 | 
					  Box::~Box() {
 | 
				
			||||||
    if (managed && data != 0) {
 | 
					    if (managed && data) {
 | 
				
			||||||
      free(data);
 | 
					      free(data);
 | 
				
			||||||
      data = 0;
 | 
					      data = 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue