Various NULL checks
Fixes https://scan5.scan.coverity.com/#/project-view/62507/10222?selectedIssue=
1643035
Fixes https://scan5.scan.coverity.com/#/project-view/62507/10222?selectedIssue=
1643039
Fixes https://scan5.scan.coverity.com/#/project-view/62507/10222?selectedIssue=
1643041
Fixes https://scan5.scan.coverity.com/#/project-view/62507/10222?selectedIssue=
1643044
Fixes https://scan5.scan.coverity.com/#/project-view/62507/10222?selectedIssue=
1643045
Fixes https://scan5.scan.coverity.com/#/project-view/62507/10222?selectedIssue=
1643046
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26840)