int i2o_SCT_signature(const SCT *sct, unsigned char **out)
{
size_t len;
- unsigned char *p = NULL;
+ unsigned char *p = NULL, *pstart = NULL;
if (!SCT_signature_is_complete(sct)) {
CTerr(CT_F_I2O_SCT_SIGNATURE, CT_R_SCT_INVALID_SIGNATURE);
p = *out;
*out += len;
} else {
- p = OPENSSL_malloc(len);
+ pstart = p = OPENSSL_malloc(len);
if (p == NULL) {
CTerr(CT_F_I2O_SCT_SIGNATURE, ERR_R_MALLOC_FAILURE);
goto err;
return len;
err:
- OPENSSL_free(p);
+ OPENSSL_free(pstart);
return -1;
}
int i2o_SCT(const SCT *sct, unsigned char **out)
{
size_t len;
- unsigned char *p = NULL;
+ unsigned char *p = NULL, *pstart = NULL;
if (!SCT_is_complete(sct)) {
CTerr(CT_F_I2O_SCT, CT_R_SCT_NOT_SET);
p = *out;
*out += len;
} else {
- p = OPENSSL_malloc(len);
+ pstart = p = OPENSSL_malloc(len);
if (p == NULL) {
CTerr(CT_F_I2O_SCT, ERR_R_MALLOC_FAILURE);
goto err;
return len;
err:
- OPENSSL_free(p);
+ OPENSSL_free(pstart);
return -1;
}