swtpm_cert: Test for NULL pointer returned by malloc

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
Stefan Berger 2022-05-25 15:34:57 -04:00 committed by Stefan Berger
parent 42d5f3b50f
commit c269da7869

View File

@ -197,6 +197,10 @@ hex_str_to_bin(const char *hexstr, int *modulus_len)
}
result = malloc(len / 2);
if (result == NULL) {
fprintf(stderr, "Out of memory tring to allocated %d bytes.", len / 2);
return NULL;
}
i = 0;
j = 0;