|
@@ -145,7 +145,7 @@ static int pem_asn1 ( struct image *image, size_t offset,
|
145
|
145
|
*cursor = malloc ( sizeof ( **cursor ) + decoded_max_len );
|
146
|
146
|
if ( ! *cursor ) {
|
147
|
147
|
rc = -ENOMEM;
|
148
|
|
- goto err_alloc_decoded;
|
|
148
|
+ goto err_alloc_cursor;
|
149
|
149
|
}
|
150
|
150
|
decoded = ( ( ( void * ) *cursor ) + sizeof ( **cursor ) );
|
151
|
151
|
|
|
@@ -172,8 +172,9 @@ static int pem_asn1 ( struct image *image, size_t offset,
|
172
|
172
|
return offset;
|
173
|
173
|
|
174
|
174
|
err_decode:
|
175
|
|
- free ( decoded );
|
176
|
|
- err_alloc_decoded:
|
|
175
|
+ free ( *cursor );
|
|
176
|
+ *cursor = NULL;
|
|
177
|
+ err_alloc_cursor:
|
177
|
178
|
free ( encoded );
|
178
|
179
|
err_alloc_encoded:
|
179
|
180
|
err_end:
|