mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zipl: extract_signature: fix memory leak of @signature
Fix memory leak @signature in case of an unsupported signature type. Reviewed-by: Steffen Eiden <seiden@linux.ibm.com> Reviewed-by: Stefan Haberland <sth@linux.ibm.com> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
committed by
Steffen Eiden
parent
21dbbcfa56
commit
0e86da9d66
@@ -511,9 +511,6 @@ extract_signature(const char *filename, void **ret_signature,
|
||||
memcpy(signature, buffer + size - signature_size - sizeof(*file_sig),
|
||||
signature_size);
|
||||
|
||||
*ret_signature = signature;
|
||||
sig_head->length = signature_size;
|
||||
|
||||
switch (file_sig->id_type) {
|
||||
case PKEY_ID_PKCS7:
|
||||
sig_head->format = PKCS7_FORMAT;
|
||||
@@ -522,8 +519,12 @@ extract_signature(const char *filename, void **ret_signature,
|
||||
error_text("Unsupported signature type %02x",
|
||||
file_sig->id_type);
|
||||
signature_size = 0;
|
||||
free(signature);
|
||||
goto out;
|
||||
}
|
||||
|
||||
sig_head->length = signature_size;
|
||||
*ret_signature = signature;
|
||||
/* return size of signature and corresponding header */
|
||||
signature_size += sizeof(*file_sig);
|
||||
out:
|
||||
|
||||
Reference in New Issue
Block a user