Fixes #1971 (memory leak in basic_json::push_back)
This commit is contained in:
		
							parent
							
								
									19843b038c
								
							
						
					
					
						commit
						e4d8dc02e8
					
				
					 3 changed files with 50 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -4878,9 +4878,7 @@ class basic_json
 | 
			
		|||
 | 
			
		||||
        // add element to array (move semantics)
 | 
			
		||||
        m_value.array->push_back(std::move(val));
 | 
			
		||||
        // invalidate object: mark it null so we do not call the destructor
 | 
			
		||||
        // cppcheck-suppress accessMoved
 | 
			
		||||
        val.m_type = value_t::null;
 | 
			
		||||
        // if val is moved from, basic_json move constructor marks it null so we do not call the destructor
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /*!
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue