We should NULL out mac after freeing it, so that the cleanup code
doesn't try to free it again; also if the final key creation fails, we
should avoid freeing ret->comment when we're going to go to that same
cleanup code which will free 'comment' which contains the same pointer.
Thanks to Christopher Staite for pointing these out.
}
}
sfree(mac);
+ mac = NULL;
/*
* Create and return the key.
ret->data = alg->createkey(public_blob, public_blob_len,
private_blob, private_blob_len);
if (!ret->data) {
- sfree(ret->comment);
sfree(ret);
ret = NULL;
error = "createkey failed";