Bug 1118383 - Plug memory leak in openaes - r=cpearce a=lmandel
authorEdwin Flores <eflores@mozilla.com>
Tue, 27 Jan 2015 19:10:11 +1300
changeset 250176 5525ed289797
parent 250175 bb90dd41c737
child 250177 dccbd236f4f8
push id4521
push usercpearce@mozilla.com
push date2015-03-04 01:22 +0000
treeherdermozilla-beta@8abdbdecd2d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce, lmandel
bugs1118383
milestone37.0
Bug 1118383 - Plug memory leak in openaes - r=cpearce a=lmandel
media/gmp-clearkey/0.1/openaes/oaes_lib.c
--- a/media/gmp-clearkey/0.1/openaes/oaes_lib.c
+++ b/media/gmp-clearkey/0.1/openaes/oaes_lib.c
@@ -624,17 +624,20 @@ static OAES_RET oaes_key_gen( OAES_CTX *
 	
 	if( _ctx->key )
 		oaes_key_destroy( &(_ctx->key) );
 	
 	_key->data_len = key_size;
 	_key->data = (uint8_t *) calloc( key_size, sizeof( uint8_t ));
 	
 	if( NULL == _key->data )
+	{
+		oaes_key_destroy( &_key );
 		return OAES_RET_MEM;
+	}
 	
 	for( _i = 0; _i < key_size; _i++ )
 		_key->data[_i] = (uint8_t) OAES_RAND(_ctx->rctx);
 	
 	_ctx->key = _key;
 	_rc = _rc || oaes_key_expand( ctx );
 	
 	if( _rc != OAES_RET_SUCCESS )