i = atoi(arg);
if (i >= 0)
pwdbio = BIO_new_fd(i, BIO_NOCLOSE);
- if ((i < 0) || !pwdbio) {
+ if ((i < 0) || pwdbio == NULL) {
BIO_printf(bio_err, "Can't access file descriptor %s\n", arg);
return NULL;
}
* Can't do BIO_gets on an fd BIO so add a buffering BIO
*/
btmp = BIO_new(BIO_f_buffer());
+ if (btmp == NULL) {
+ BIO_free_all(pwdbio);
+ pwdbio = NULL;
+ BIO_printf(bio_err, "Out of memory\n");
+ return NULL;
+ }
pwdbio = BIO_push(btmp, pwdbio);
#endif
} else if (strcmp(arg, "stdin") == 0) {
if (bio_c_out == NULL) {
if (c_quiet && !c_debug) {
bio_c_out = BIO_new(BIO_s_null());
- if (c_msg && bio_c_msg == NULL)
+ if (c_msg && bio_c_msg == NULL) {
bio_c_msg = dup_bio_out(FORMAT_TEXT);
- } else if (bio_c_out == NULL)
+ if (bio_c_msg == NULL) {
+ BIO_printf(bio_err, "Out of memory\n");
+ goto end;
+ }
+ }
+ } else {
bio_c_out = dup_bio_out(FORMAT_TEXT);
+ }
+
+ if (bio_c_out == NULL) {
+ BIO_printf(bio_err, "Unable to create BIO\n");
+ goto end;
+ }
}
#ifndef OPENSSL_NO_SRP
if (!app_passwd(srppass, NULL, &srp_arg.srppassin, NULL)) {
#endif
sbio = BIO_new_dgram(sock, BIO_NOCLOSE);
- if ((peer_info.addr = BIO_ADDR_new()) == NULL) {
+ if (sbio == NULL || (peer_info.addr = BIO_ADDR_new()) == NULL) {
BIO_printf(bio_err, "memory allocation failure\n");
+ BIO_free(sbio);
BIO_closesocket(sock);
goto end;
}
if (!BIO_sock_info(sock, BIO_SOCK_INFO_ADDRESS, &peer_info)) {
BIO_printf(bio_err, "getsockname:errno=%d\n",
get_last_socket_error());
+ BIO_free(sbio);
BIO_ADDR_free(peer_info.addr);
BIO_closesocket(sock);
goto end;
#endif /* OPENSSL_NO_DTLS */
sbio = BIO_new_socket(sock, BIO_NOCLOSE);
+ if (sbio == NULL) {
+ BIO_printf(bio_err, "Unable to create BIO\n");
+ ERR_print_errors(bio_err);
+ BIO_closesocket(sock);
+ goto end;
+ }
+
if (nbio_test) {
BIO *test;
test = BIO_new(BIO_f_nbio_test());
+ if (test == NULL) {
+ BIO_printf(bio_err, "Unable to create BIO\n");
+ BIO_free(sbio);
+ goto shut;
+ }
sbio = BIO_push(test, sbio);
}
int foundit = 0;
BIO *fbio = BIO_new(BIO_f_buffer());
+ if (fbio == NULL) {
+ BIO_printf(bio_err, "Unable to create BIO\n");
+ goto shut;
+ }
BIO_push(fbio, sbio);
/* Wait for multi-line response to end from LMTP or SMTP */
do {
int foundit = 0;
BIO *fbio = BIO_new(BIO_f_buffer());
+ if (fbio == NULL) {
+ BIO_printf(bio_err, "Unable to create BIO\n");
+ goto shut;
+ }
BIO_push(fbio, sbio);
BIO_gets(fbio, mbuf, BUFSIZZ);
/* STARTTLS command requires CAPABILITY... */
{
BIO *fbio = BIO_new(BIO_f_buffer());
+ if (fbio == NULL) {
+ BIO_printf(bio_err, "Unable to create BIO\n");
+ goto shut;
+ }
BIO_push(fbio, sbio);
/* wait for multi-line response to end from FTP */
do {
int numeric;
BIO *fbio = BIO_new(BIO_f_buffer());
+ if (fbio == NULL) {
+ BIO_printf(bio_err, "Unable to create BIO\n");
+ goto end;
+ }
BIO_push(fbio, sbio);
BIO_printf(fbio, "STARTTLS\r\n");
(void)BIO_flush(fbio);
int foundit = 0;
BIO *fbio = BIO_new(BIO_f_buffer());
+ if (fbio == NULL) {
+ BIO_printf(bio_err, "Unable to create BIO\n");
+ goto end;
+ }
BIO_push(fbio, sbio);
BIO_gets(fbio, mbuf, BUFSIZZ);
/* STARTTLS command requires CAPABILITIES... */
int foundit = 0;
BIO *fbio = BIO_new(BIO_f_buffer());
+ if (fbio == NULL) {
+ BIO_printf(bio_err, "Unable to create BIO\n");
+ goto end;
+ }
BIO_push(fbio, sbio);
/* wait for multi-line response to end from Sieve */
do {
BIO *ldapbio = BIO_new(BIO_s_mem());
CONF *cnf = NCONF_new(NULL);
- if (cnf == NULL) {
+ if (ldapbio == NULL || cnf == NULL) {
BIO_free(ldapbio);
+ NCONF_free(cnf);
goto end;
}
BIO_puts(ldapbio, ldap_tls_genconf);