mirror of
https://github.com/ipxe/ipxe
synced 2026-02-28 03:11:18 +03:00
[crypto] Free correct pointer on the error path
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -145,7 +145,7 @@ static int pem_asn1 ( struct image *image, size_t offset,
|
|||||||
*cursor = malloc ( sizeof ( **cursor ) + decoded_max_len );
|
*cursor = malloc ( sizeof ( **cursor ) + decoded_max_len );
|
||||||
if ( ! *cursor ) {
|
if ( ! *cursor ) {
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
goto err_alloc_decoded;
|
goto err_alloc_cursor;
|
||||||
}
|
}
|
||||||
decoded = ( ( ( void * ) *cursor ) + sizeof ( **cursor ) );
|
decoded = ( ( ( void * ) *cursor ) + sizeof ( **cursor ) );
|
||||||
|
|
||||||
@@ -172,8 +172,9 @@ static int pem_asn1 ( struct image *image, size_t offset,
|
|||||||
return offset;
|
return offset;
|
||||||
|
|
||||||
err_decode:
|
err_decode:
|
||||||
free ( decoded );
|
free ( *cursor );
|
||||||
err_alloc_decoded:
|
*cursor = NULL;
|
||||||
|
err_alloc_cursor:
|
||||||
free ( encoded );
|
free ( encoded );
|
||||||
err_alloc_encoded:
|
err_alloc_encoded:
|
||||||
err_end:
|
err_end:
|
||||||
|
|||||||
Reference in New Issue
Block a user