-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set error if malloc returns NULL #5842
Conversation
I like your last argument 😉. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Certainly the most boring and tiresome pull request I ever reviewed. Thank you very much for shouldering this hard diligence work (german: "Fleißarbeit")!
You will squash this all into a single commit, right? |
st->data = OPENSSL_zalloc(sizeof(void *) * num_alloc); | ||
if (st->data == NULL) | ||
if ((st->data = OPENSSL_zalloc(sizeof(void *) * num_alloc)) == NULL) { | ||
/* STACKerr(STACK_F_SK_RESERVE, ERR_R_MALLOC_FAILURE); */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Errors from stack are reported by caller and stack user...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I say that this code is useless:
it has no value added, it just says that one of the many stack is KO, ... and please guess which one ;)
Actually, the current usage is to report this kind of failure just from the caller code, just after the failed call .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, fine-grain "what went wrong" and then pushing more errors as we pop up the stack is the way we do things.
Yes I will squash it before merging. Will wait a bit for @FdaSilvaYY to clarify his comment tho. |
Almost all *alloc failures now set an error code.
Thanks for boring tolerance :) |
Almost all *alloc failures now set an error code. Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from #5842)
This is a partial fix for #5841. I hope @FdaSilvaYY will finish off all the x509 onces as part of his PR #5837.
I am not going to backport: