mirror of https://github.com/openssl/openssl.git
				
				
				
			Clean up on failed BIO creation
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/16316)
This commit is contained in:
		
							parent
							
								
									5001287c0d
								
							
						
					
					
						commit
						f11c01a666
					
				|  | @ -168,14 +168,17 @@ static void setup_trace_category(int category) | |||
| { | ||||
|     BIO *channel; | ||||
|     tracedata *trace_data; | ||||
|     BIO *bio = NULL; | ||||
| 
 | ||||
|     if (OSSL_trace_enabled(category)) | ||||
|         return; | ||||
| 
 | ||||
|     channel = BIO_push(BIO_new(BIO_f_prefix()), dup_bio_err(FORMAT_TEXT)); | ||||
|     bio = BIO_new(BIO_f_prefix()); | ||||
|     channel = BIO_push(bio, dup_bio_err(FORMAT_TEXT)); | ||||
|     trace_data = OPENSSL_zalloc(sizeof(*trace_data)); | ||||
| 
 | ||||
|     if (trace_data == NULL | ||||
|         || bio == NULL | ||||
|         || (trace_data->bio = channel) == NULL | ||||
|         || OSSL_trace_set_callback(category, internal_trace_cb, | ||||
|                                    trace_data) == 0 | ||||
|  |  | |||
|  | @ -71,15 +71,18 @@ static void setup_trace_category(int category) | |||
| { | ||||
|     BIO *channel; | ||||
|     tracedata *trace_data; | ||||
|     BIO *bio = NULL; | ||||
| 
 | ||||
|     if (OSSL_trace_enabled(category)) | ||||
|         return; | ||||
| 
 | ||||
|     channel = BIO_push(BIO_new(BIO_f_prefix()), | ||||
|     bio = BIO_new(BIO_f_prefix()); | ||||
|     channel = BIO_push(bio, | ||||
|                        BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT)); | ||||
|     trace_data = OPENSSL_zalloc(sizeof(*trace_data)); | ||||
| 
 | ||||
|     if (trace_data == NULL | ||||
|         || bio == NULL | ||||
|         || (trace_data->bio = channel) == NULL | ||||
|         || OSSL_trace_set_callback(category, internal_trace_cb, | ||||
|                                    trace_data) == 0 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue