mirror of https://github.com/openssl/openssl.git
				
				
				
			apps/cmp.c: Fix memory leaks in handle_opt_geninfo() found by Coverity
CID 1463578: Resource leaks (RESOURCE_LEAK) CID 1463575: Resource leaks (RESOURCE_LEAK) Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/12231)
This commit is contained in:
		
							parent
							
								
									1b0f5b62ff
								
							
						
					
					
						commit
						33c41876ed
					
				|  | @ -2042,12 +2042,11 @@ static int handle_opt_geninfo(OSSL_CMP_CTX *ctx) | ||||||
|         return 0; |         return 0; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     aint = ASN1_INTEGER_new(); |     if ((aint = ASN1_INTEGER_new()) == NULL) | ||||||
|     if (aint == NULL || !ASN1_INTEGER_set(aint, value)) |  | ||||||
|         goto oom; |         goto oom; | ||||||
| 
 | 
 | ||||||
|     val = ASN1_TYPE_new(); |     val = ASN1_TYPE_new(); | ||||||
|     if (val == NULL) { |     if (!ASN1_INTEGER_set(aint, value) || val == NULL) { | ||||||
|         ASN1_INTEGER_free(aint); |         ASN1_INTEGER_free(aint); | ||||||
|         goto oom; |         goto oom; | ||||||
|     } |     } | ||||||
|  | @ -2065,6 +2064,7 @@ static int handle_opt_geninfo(OSSL_CMP_CTX *ctx) | ||||||
|     return 1; |     return 1; | ||||||
| 
 | 
 | ||||||
|  oom: |  oom: | ||||||
|  |     ASN1_OBJECT_free(type); | ||||||
|     CMP_err("out of memory"); |     CMP_err("out of memory"); | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue