mirror of
https://github.com/openssl/openssl.git
synced 2025-02-17 14:32:04 +08:00
free NULL cleanup
This commit handles BIO_ACCEPT_free BIO_CB_FREE BIO_CONNECT_free BIO_free BIO_free_all BIO_vfree Reviewed-by: Matt Caswell <matt@openssl.org>
This commit is contained in:
parent
2011b169fa
commit
ca3a82c3b3
12
apps/apps.c
12
apps/apps.c
@ -1114,8 +1114,7 @@ EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
|
||||
goto end;
|
||||
}
|
||||
end:
|
||||
if (key != NULL)
|
||||
BIO_free(key);
|
||||
BIO_free(key);
|
||||
if (pkey == NULL)
|
||||
BIO_printf(err, "unable to load %s\n", key_descrip);
|
||||
return (pkey);
|
||||
@ -1682,8 +1681,7 @@ BIGNUM *load_serial(char *serialfile, int create, ASN1_INTEGER **retai)
|
||||
ai = NULL;
|
||||
}
|
||||
err:
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
BIO_free(in);
|
||||
if (ai != NULL)
|
||||
ASN1_INTEGER_free(ai);
|
||||
return (ret);
|
||||
@ -1741,8 +1739,7 @@ int save_serial(char *serialfile, char *suffix, BIGNUM *serial,
|
||||
ai = NULL;
|
||||
}
|
||||
err:
|
||||
if (out != NULL)
|
||||
BIO_free_all(out);
|
||||
BIO_free_all(out);
|
||||
if (ai != NULL)
|
||||
ASN1_INTEGER_free(ai);
|
||||
return (ret);
|
||||
@ -1896,8 +1893,7 @@ CA_DB *load_index(char *dbfile, DB_ATTR *db_attr)
|
||||
NCONF_free(dbattr_conf);
|
||||
if (tmpdb)
|
||||
TXT_DB_free(tmpdb);
|
||||
if (in)
|
||||
BIO_free_all(in);
|
||||
BIO_free_all(in);
|
||||
return retdb;
|
||||
}
|
||||
|
||||
|
@ -370,12 +370,9 @@ int MAIN(int argc, char **argv)
|
||||
ret = 0;
|
||||
end:
|
||||
BIO_free(derout);
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
if (out != NULL)
|
||||
BIO_free_all(out);
|
||||
if (b64 != NULL)
|
||||
BIO_free(b64);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
BIO_free(b64);
|
||||
if (ret != 0)
|
||||
ERR_print_errors(bio_err);
|
||||
if (buf != NULL)
|
||||
|
@ -1566,8 +1566,7 @@ static int certify(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
|
||||
err:
|
||||
if (req != NULL)
|
||||
X509_REQ_free(req);
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
BIO_free(in);
|
||||
return (ok);
|
||||
}
|
||||
|
||||
|
@ -227,8 +227,7 @@ int MAIN(int argc, char **argv)
|
||||
SSL_CTX_free(ctx);
|
||||
if (ssl != NULL)
|
||||
SSL_free(ssl);
|
||||
if (STDout != NULL)
|
||||
BIO_free_all(STDout);
|
||||
BIO_free_all(STDout);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
@ -268,10 +268,8 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
ret = 0;
|
||||
end:
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
if (out != NULL)
|
||||
BIO_free_all(out);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
if (p7 != NULL)
|
||||
PKCS7_free(p7);
|
||||
if (crl != NULL)
|
||||
@ -326,8 +324,7 @@ static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile)
|
||||
ret = count;
|
||||
end:
|
||||
/* never need to OPENSSL_free x */
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
BIO_free(in);
|
||||
if (sk != NULL)
|
||||
sk_X509_INFO_free(sk);
|
||||
return (ret);
|
||||
|
@ -518,8 +518,7 @@ int MAIN(int argc, char **argv)
|
||||
OPENSSL_cleanse(buf, BUFSIZE);
|
||||
OPENSSL_free(buf);
|
||||
}
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
BIO_free(in);
|
||||
if (passin)
|
||||
OPENSSL_free(passin);
|
||||
BIO_free_all(out);
|
||||
@ -530,8 +529,7 @@ int MAIN(int argc, char **argv)
|
||||
sk_OPENSSL_STRING_free(macopts);
|
||||
if (sigbuf)
|
||||
OPENSSL_free(sigbuf);
|
||||
if (bmd != NULL)
|
||||
BIO_free(bmd);
|
||||
BIO_free(bmd);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(err);
|
||||
}
|
||||
|
@ -310,10 +310,8 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
ret = 0;
|
||||
end:
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
if (out != NULL)
|
||||
BIO_free_all(out);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
DH_free(dh);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
|
@ -515,10 +515,8 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
ret = 0;
|
||||
end:
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
if (out != NULL)
|
||||
BIO_free_all(out);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
DH_free(dh);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
|
@ -356,10 +356,8 @@ int MAIN(int argc, char **argv)
|
||||
} else
|
||||
ret = 0;
|
||||
end:
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
if (out != NULL)
|
||||
BIO_free_all(out);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
DSA_free(dsa);
|
||||
if (passin)
|
||||
OPENSSL_free(passin);
|
||||
|
@ -434,10 +434,8 @@ int MAIN(int argc, char **argv)
|
||||
end:
|
||||
if (cb != NULL)
|
||||
BN_GENCB_free(cb);
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
if (out != NULL)
|
||||
BIO_free_all(out);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
DSA_free(dsa);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
|
@ -343,10 +343,8 @@ int MAIN(int argc, char **argv)
|
||||
} else
|
||||
ret = 0;
|
||||
end:
|
||||
if (in)
|
||||
BIO_free(in);
|
||||
if (out)
|
||||
BIO_free_all(out);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
if (eckey)
|
||||
EC_KEY_free(eckey);
|
||||
if (passin)
|
||||
|
@ -621,10 +621,8 @@ int MAIN(int argc, char **argv)
|
||||
BN_free(ec_cofactor);
|
||||
if (buffer)
|
||||
OPENSSL_free(buffer);
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
if (out != NULL)
|
||||
BIO_free_all(out);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
if (group != NULL)
|
||||
EC_GROUP_free(group);
|
||||
apps_shutdown();
|
||||
|
15
apps/enc.c
15
apps/enc.c
@ -657,17 +657,12 @@ int MAIN(int argc, char **argv)
|
||||
OPENSSL_free(strbuf);
|
||||
if (buff != NULL)
|
||||
OPENSSL_free(buff);
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
if (out != NULL)
|
||||
BIO_free_all(out);
|
||||
if (benc != NULL)
|
||||
BIO_free(benc);
|
||||
if (b64 != NULL)
|
||||
BIO_free(b64);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
BIO_free(benc);
|
||||
BIO_free(b64);
|
||||
#ifdef ZLIB
|
||||
if (bzl != NULL)
|
||||
BIO_free(bzl);
|
||||
BIO_free(bzl);
|
||||
#endif
|
||||
if (pass)
|
||||
OPENSSL_free(pass);
|
||||
|
@ -497,8 +497,7 @@ int MAIN(int argc, char **argv)
|
||||
sk_OPENSSL_STRING_pop_free(engines, identity);
|
||||
sk_OPENSSL_STRING_pop_free(pre_cmds, identity);
|
||||
sk_OPENSSL_STRING_pop_free(post_cmds, identity);
|
||||
if (bio_out != NULL)
|
||||
BIO_free_all(bio_out);
|
||||
BIO_free_all(bio_out);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
@ -100,8 +100,7 @@ int MAIN(int argc, char **argv)
|
||||
lh_ERR_STRING_DATA_node_usage_stats_bio(ERR_get_string_table(),
|
||||
out);
|
||||
}
|
||||
if (out != NULL)
|
||||
BIO_free_all(out);
|
||||
BIO_free_all(out);
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
|
@ -210,8 +210,7 @@ int MAIN(int argc, char **argv)
|
||||
end:
|
||||
if (ret != 0)
|
||||
ERR_print_errors(bio_err);
|
||||
if (out != NULL)
|
||||
BIO_free_all(out);
|
||||
BIO_free_all(out);
|
||||
DH_free(dh);
|
||||
if (cb != NULL)
|
||||
BN_GENCB_free(cb);
|
||||
|
@ -267,10 +267,8 @@ int MAIN(int argc, char **argv)
|
||||
end:
|
||||
if (ret != 0)
|
||||
ERR_print_errors(bio_err);
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
if (out != NULL)
|
||||
BIO_free_all(out);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
DSA_free(dsa);
|
||||
if (passout)
|
||||
OPENSSL_free(passout);
|
||||
|
@ -272,8 +272,7 @@ int MAIN(int argc, char **argv)
|
||||
EVP_PKEY_free(pkey);
|
||||
if (ctx)
|
||||
EVP_PKEY_CTX_free(ctx);
|
||||
if (out)
|
||||
BIO_free_all(out);
|
||||
BIO_free_all(out);
|
||||
BIO_free(in);
|
||||
if (pass)
|
||||
OPENSSL_free(pass);
|
||||
|
@ -312,8 +312,7 @@ int MAIN(int argc, char **argv)
|
||||
if (cb)
|
||||
BN_GENCB_free(cb);
|
||||
RSA_free(rsa);
|
||||
if (out)
|
||||
BIO_free_all(out);
|
||||
BIO_free_all(out);
|
||||
if (passout)
|
||||
OPENSSL_free(passout);
|
||||
if (ret != 0)
|
||||
|
@ -1362,8 +1362,7 @@ OCSP_RESPONSE *process_responder(BIO *err, OCSP_REQUEST *req,
|
||||
if (!resp)
|
||||
BIO_printf(bio_err, "Error querying OCSP responder\n");
|
||||
end:
|
||||
if (cbio)
|
||||
BIO_free_all(cbio);
|
||||
BIO_free_all(cbio);
|
||||
if (ctx)
|
||||
SSL_CTX_free(ctx);
|
||||
return resp;
|
||||
|
@ -431,10 +431,8 @@ int main(int Argc, char *ARGV[])
|
||||
#endif
|
||||
apps_shutdown();
|
||||
CRYPTO_mem_leaks(bio_err);
|
||||
if (bio_err != NULL) {
|
||||
BIO_free(bio_err);
|
||||
bio_err = NULL;
|
||||
}
|
||||
BIO_free(bio_err);
|
||||
bio_err = NULL;
|
||||
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
@ -273,10 +273,8 @@ int MAIN(int argc, char **argv)
|
||||
OPENSSL_free(salt_malloc);
|
||||
if (passwd_malloc)
|
||||
OPENSSL_free(passwd_malloc);
|
||||
if (in)
|
||||
BIO_free(in);
|
||||
if (out)
|
||||
BIO_free_all(out);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
@ -299,10 +299,8 @@ int MAIN(int argc, char **argv)
|
||||
end:
|
||||
if (p7 != NULL)
|
||||
PKCS7_free(p7);
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
if (out != NULL)
|
||||
BIO_free_all(out);
|
||||
BIO_free(in);
|
||||
BIO_free_all(out);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
@ -222,8 +222,7 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
err:
|
||||
ERR_print_errors(bio_err);
|
||||
if (out)
|
||||
BIO_free_all(out);
|
||||
BIO_free_all(out);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
@ -422,8 +422,7 @@ int MAIN(int argc, char **argv)
|
||||
} else
|
||||
ret = 0;
|
||||
end:
|
||||
if (out != NULL)
|
||||
BIO_free_all(out);
|
||||
BIO_free_all(out);
|
||||
RSA_free(rsa);
|
||||
if (passin)
|
||||
OPENSSL_free(passin);
|
||||
|
@ -2059,14 +2059,10 @@ int MAIN(int argc, char **argv)
|
||||
OPENSSL_cleanse(mbuf, BUFSIZZ);
|
||||
OPENSSL_free(mbuf);
|
||||
}
|
||||
if (bio_c_out != NULL) {
|
||||
BIO_free(bio_c_out);
|
||||
bio_c_out = NULL;
|
||||
}
|
||||
if (bio_c_msg != NULL) {
|
||||
BIO_free(bio_c_msg);
|
||||
bio_c_msg = NULL;
|
||||
}
|
||||
BIO_free(bio_c_out);
|
||||
bio_c_out = NULL;
|
||||
BIO_free(bio_c_msg);
|
||||
bio_c_msg = NULL;
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
@ -2039,8 +2039,7 @@ int MAIN(int argc, char *argv[])
|
||||
X509_free(s_cert2);
|
||||
if (s_key2)
|
||||
EVP_PKEY_free(s_key2);
|
||||
if (serverinfo_in != NULL)
|
||||
BIO_free(serverinfo_in);
|
||||
BIO_free(serverinfo_in);
|
||||
# ifndef OPENSSL_NO_NEXTPROTONEG
|
||||
if (next_proto.data)
|
||||
OPENSSL_free(next_proto.data);
|
||||
@ -2057,14 +2056,10 @@ int MAIN(int argc, char *argv[])
|
||||
if (jpake_secret && psk_key)
|
||||
OPENSSL_free(psk_key);
|
||||
#endif
|
||||
if (bio_s_out != NULL) {
|
||||
BIO_free(bio_s_out);
|
||||
bio_s_out = NULL;
|
||||
}
|
||||
if (bio_s_msg != NULL) {
|
||||
BIO_free(bio_s_msg);
|
||||
bio_s_msg = NULL;
|
||||
}
|
||||
BIO_free(bio_s_out);
|
||||
bio_s_out = NULL;
|
||||
BIO_free(bio_s_msg);
|
||||
bio_s_msg = NULL;
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
@ -2661,8 +2656,7 @@ static DH *load_dh_param(const char *dhfile)
|
||||
goto err;
|
||||
ret = PEM_read_bio_DHparams(bio, NULL, NULL, NULL);
|
||||
err:
|
||||
if (bio != NULL)
|
||||
BIO_free(bio);
|
||||
BIO_free(bio);
|
||||
return (ret);
|
||||
}
|
||||
#endif
|
||||
@ -3021,9 +3015,7 @@ static int www_body(char *hostname, int s, int stype, unsigned char *context)
|
||||
|
||||
if (buf != NULL)
|
||||
OPENSSL_free(buf);
|
||||
if (io != NULL)
|
||||
BIO_free_all(io);
|
||||
/* if (ssl_bio != NULL) BIO_free(ssl_bio);*/
|
||||
BIO_free_all(io);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@ -3159,8 +3151,7 @@ static int rev_body(char *hostname, int s, int stype, unsigned char *context)
|
||||
|
||||
if (buf != NULL)
|
||||
OPENSSL_free(buf);
|
||||
if (io != NULL)
|
||||
BIO_free_all(io);
|
||||
BIO_free_all(io);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
@ -237,8 +237,7 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
ret = 0;
|
||||
end:
|
||||
if (out != NULL)
|
||||
BIO_free_all(out);
|
||||
BIO_free_all(out);
|
||||
if (x != NULL)
|
||||
SSL_SESSION_free(x);
|
||||
apps_shutdown();
|
||||
@ -279,7 +278,6 @@ static SSL_SESSION *load_sess_id(char *infile, int format)
|
||||
}
|
||||
|
||||
end:
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
BIO_free(in);
|
||||
return (x);
|
||||
}
|
||||
|
@ -162,8 +162,8 @@ int MAIN(int argc, char **argv)
|
||||
apps_startup();
|
||||
|
||||
if (bio_err == NULL && (bio_err = BIO_new(BIO_s_file())) != NULL) {
|
||||
free_bio_err = 1;
|
||||
BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
|
||||
free_bio_err = 1;
|
||||
}
|
||||
|
||||
if (!load_config(bio_err, NULL))
|
||||
|
@ -650,8 +650,7 @@ static int multi_split(BIO *bio, char *bound, STACK_OF(BIO) **ret)
|
||||
BIO_write(bpart, linebuf, len);
|
||||
}
|
||||
}
|
||||
if (bpart != NULL)
|
||||
BIO_free(bpart);
|
||||
BIO_free(bpart);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -179,8 +179,8 @@ static int asn1_bio_init(BIO_ASN1_BUF_CTX *ctx, int size)
|
||||
|
||||
static int asn1_bio_free(BIO *b)
|
||||
{
|
||||
BIO_ASN1_BUF_CTX *ctx;
|
||||
ctx = (BIO_ASN1_BUF_CTX *)b->ptr;
|
||||
BIO_ASN1_BUF_CTX *ctx = (BIO_ASN1_BUF_CTX *)b->ptr;
|
||||
|
||||
if (ctx == NULL)
|
||||
return 0;
|
||||
if (ctx->buf)
|
||||
|
@ -142,8 +142,7 @@ BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it)
|
||||
return sarg.ndef_bio;
|
||||
|
||||
err:
|
||||
if (asn_bio)
|
||||
BIO_free(asn_bio);
|
||||
BIO_free(asn_bio);
|
||||
if (ndef_aux)
|
||||
OPENSSL_free(ndef_aux);
|
||||
return NULL;
|
||||
|
@ -549,8 +549,7 @@ BIO *BIO_dup_chain(BIO *in)
|
||||
}
|
||||
return (ret);
|
||||
err:
|
||||
if (ret != NULL)
|
||||
BIO_free(ret);
|
||||
BIO_free(ret);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
@ -155,8 +155,7 @@ static void BIO_ACCEPT_free(BIO_ACCEPT *a)
|
||||
OPENSSL_free(a->param_addr);
|
||||
if (a->addr != NULL)
|
||||
OPENSSL_free(a->addr);
|
||||
if (a->bio_chain != NULL)
|
||||
BIO_free(a->bio_chain);
|
||||
BIO_free(a->bio_chain);
|
||||
OPENSSL_free(a);
|
||||
}
|
||||
|
||||
@ -360,8 +359,7 @@ static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
} else if (num == 1) {
|
||||
data->accept_nbio = (ptr != NULL);
|
||||
} else if (num == 2) {
|
||||
if (data->bio_chain != NULL)
|
||||
BIO_free(data->bio_chain);
|
||||
BIO_free(data->bio_chain);
|
||||
data->bio_chain = (BIO *)ptr;
|
||||
}
|
||||
}
|
||||
@ -448,10 +446,8 @@ BIO *BIO_new_accept(const char *str)
|
||||
return (NULL);
|
||||
if (BIO_set_accept_port(ret, str))
|
||||
return (ret);
|
||||
else {
|
||||
BIO_free(ret);
|
||||
return (NULL);
|
||||
}
|
||||
BIO_free(ret);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -788,14 +788,10 @@ int BIO_new_bio_pair(BIO **bio1_p, size_t writebuf1,
|
||||
|
||||
err:
|
||||
if (ret == 0) {
|
||||
if (bio1) {
|
||||
BIO_free(bio1);
|
||||
bio1 = NULL;
|
||||
}
|
||||
if (bio2) {
|
||||
BIO_free(bio2);
|
||||
bio2 = NULL;
|
||||
}
|
||||
BIO_free(bio1);
|
||||
bio1 = NULL;
|
||||
BIO_free(bio2);
|
||||
bio2 = NULL;
|
||||
}
|
||||
|
||||
*bio1_p = bio1;
|
||||
|
@ -588,10 +588,8 @@ BIO *BIO_new_connect(const char *str)
|
||||
return (NULL);
|
||||
if (BIO_set_conn_hostname(ret, str))
|
||||
return (ret);
|
||||
else {
|
||||
BIO_free(ret);
|
||||
return (NULL);
|
||||
}
|
||||
BIO_free(ret);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -354,8 +354,7 @@ BIO *cms_DigestAlgorithm_init_bio(X509_ALGOR *digestAlgorithm)
|
||||
}
|
||||
return mdbio;
|
||||
err:
|
||||
if (mdbio)
|
||||
BIO_free(mdbio);
|
||||
BIO_free(mdbio);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -806,8 +806,7 @@ BIO *cms_SignedData_init_bio(CMS_ContentInfo *cms)
|
||||
}
|
||||
return chain;
|
||||
err:
|
||||
if (chain)
|
||||
BIO_free_all(chain);
|
||||
BIO_free_all(chain);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ static int cms_copy_content(BIO *out, BIO *in, unsigned int flags)
|
||||
r = 1;
|
||||
|
||||
err:
|
||||
if (tmpout && (tmpout != out))
|
||||
if (tmpout != out)
|
||||
BIO_free(tmpout);
|
||||
return r;
|
||||
|
||||
@ -446,14 +446,13 @@ int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
|
||||
if (tmpin != dcont)
|
||||
BIO_free(tmpin);
|
||||
} else {
|
||||
|
||||
if (dcont && (tmpin == dcont))
|
||||
do_free_upto(cmsbio, dcont);
|
||||
else
|
||||
BIO_free_all(cmsbio);
|
||||
}
|
||||
|
||||
if (tmpout && out != tmpout)
|
||||
if (out != tmpout)
|
||||
BIO_free_all(tmpout);
|
||||
|
||||
if (cms_certs)
|
||||
@ -580,8 +579,7 @@ CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si,
|
||||
r = 1;
|
||||
|
||||
err:
|
||||
if (rct_cont)
|
||||
BIO_free(rct_cont);
|
||||
BIO_free(rct_cont);
|
||||
if (r)
|
||||
return cms;
|
||||
CMS_ContentInfo_free(cms);
|
||||
|
@ -218,10 +218,8 @@ int main(int argc, char **argv)
|
||||
ERR_remove_thread_state(NULL);
|
||||
ERR_free_strings();
|
||||
CRYPTO_mem_leaks(bio_err);
|
||||
if (bio_err != NULL) {
|
||||
BIO_free(bio_err);
|
||||
bio_err = NULL;
|
||||
}
|
||||
BIO_free(bio_err);
|
||||
bio_err = NULL;
|
||||
# ifdef OPENSSL_SYS_NETWARE
|
||||
if (!ret)
|
||||
printf("ERROR\n");
|
||||
|
@ -563,8 +563,7 @@ int main(void)
|
||||
ERR_remove_thread_state(NULL);
|
||||
ERR_free_strings();
|
||||
CRYPTO_mem_leaks(out);
|
||||
if (out != NULL)
|
||||
BIO_free(out);
|
||||
BIO_free(out);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
@ -136,8 +136,7 @@ OCSP_REQ_CTX *OCSP_REQ_CTX_new(BIO *io, int maxline)
|
||||
|
||||
void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx)
|
||||
{
|
||||
if (rctx->mem)
|
||||
BIO_free(rctx->mem);
|
||||
BIO_free(rctx->mem);
|
||||
if (rctx->iobuf)
|
||||
OPENSSL_free(rctx->iobuf);
|
||||
OPENSSL_free(rctx);
|
||||
|
@ -128,8 +128,7 @@ static int PKCS7_bio_add_digest(BIO **pbio, X509_ALGOR *alg)
|
||||
return 1;
|
||||
|
||||
err:
|
||||
if (btmp)
|
||||
BIO_free(btmp);
|
||||
BIO_free(btmp);
|
||||
return 0;
|
||||
|
||||
}
|
||||
@ -390,16 +389,12 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio)
|
||||
BIO_push(out, bio);
|
||||
else
|
||||
out = bio;
|
||||
bio = NULL;
|
||||
if (0) {
|
||||
return out;
|
||||
|
||||
err:
|
||||
if (out != NULL)
|
||||
BIO_free_all(out);
|
||||
if (btmp != NULL)
|
||||
BIO_free_all(btmp);
|
||||
out = NULL;
|
||||
}
|
||||
return (out);
|
||||
BIO_free_all(out);
|
||||
BIO_free_all(btmp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int pkcs7_cmp_ri(PKCS7_RECIP_INFO *ri, X509 *pcert)
|
||||
@ -637,14 +632,10 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
|
||||
OPENSSL_cleanse(tkey, tkeylen);
|
||||
OPENSSL_free(tkey);
|
||||
}
|
||||
if (out != NULL)
|
||||
BIO_free_all(out);
|
||||
if (btmp != NULL)
|
||||
BIO_free_all(btmp);
|
||||
if (etmp != NULL)
|
||||
BIO_free_all(etmp);
|
||||
if (bio != NULL)
|
||||
BIO_free_all(bio);
|
||||
BIO_free_all(out);
|
||||
BIO_free_all(btmp);
|
||||
BIO_free_all(etmp);
|
||||
BIO_free_all(bio);
|
||||
out = NULL;
|
||||
}
|
||||
return (out);
|
||||
|
@ -460,8 +460,7 @@ int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file)
|
||||
|
||||
if (tmpdb)
|
||||
TXT_DB_free(tmpdb);
|
||||
if (in)
|
||||
BIO_free_all(in);
|
||||
BIO_free_all(in);
|
||||
|
||||
sk_SRP_gN_free(SRP_gN_tab);
|
||||
|
||||
|
@ -612,15 +612,11 @@ int doit(char *ctx[4])
|
||||
}
|
||||
|
||||
/* The SSL's are optionally freed in the following calls */
|
||||
if (c_to_s != NULL)
|
||||
BIO_free(c_to_s);
|
||||
if (s_to_c != NULL)
|
||||
BIO_free(s_to_c);
|
||||
BIO_free(c_to_s);
|
||||
BIO_free(s_to_c);
|
||||
|
||||
if (c_bio != NULL)
|
||||
BIO_free(c_bio);
|
||||
if (s_bio != NULL)
|
||||
BIO_free(s_bio);
|
||||
BIO_free(c_bio);
|
||||
BIO_free(s_bio);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -176,8 +176,7 @@ int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type)
|
||||
err:
|
||||
if (x != NULL)
|
||||
X509_free(x);
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
BIO_free(in);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@ -235,8 +234,7 @@ int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type)
|
||||
err:
|
||||
if (x != NULL)
|
||||
X509_CRL_free(x);
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
BIO_free(in);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
12
demos/b64.c
12
demos/b64.c
@ -243,13 +243,9 @@ char **argv;
|
||||
OPENSSL_free(strbuf);
|
||||
if (buff != NULL)
|
||||
OPENSSL_free(buff);
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
if (out != NULL)
|
||||
BIO_free(out);
|
||||
if (benc != NULL)
|
||||
BIO_free(benc);
|
||||
if (b64 != NULL)
|
||||
BIO_free(b64);
|
||||
BIO_free(in);
|
||||
BIO_free(out);
|
||||
BIO_free(benc);
|
||||
BIO_free(b64);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
@ -22,8 +22,7 @@ BIO *in = NULL;
|
||||
|
||||
void close_up()
|
||||
{
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
BIO_free(in);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -101,8 +100,7 @@ int main(int argc, char *argv[])
|
||||
if (ret) {
|
||||
ERR_print_errors_fp(stderr);
|
||||
}
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
BIO_free(in);
|
||||
exit(ret);
|
||||
return (!ret);
|
||||
}
|
||||
|
@ -137,8 +137,7 @@ int main(int argc, char *argv[])
|
||||
if (ret) {
|
||||
ERR_print_errors_fp(stderr);
|
||||
}
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
BIO_free(in);
|
||||
exit(ret);
|
||||
return (!ret);
|
||||
}
|
||||
|
@ -131,8 +131,7 @@ int main(int argc, char *argv[])
|
||||
if (ret) {
|
||||
ERR_print_errors_fp(stderr);
|
||||
}
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
BIO_free(in);
|
||||
exit(ret);
|
||||
return (!ret);
|
||||
}
|
||||
|
@ -50,10 +50,8 @@ int main(int argc, char **argv)
|
||||
|
||||
if (cms)
|
||||
CMS_ContentInfo_free(cms);
|
||||
if (in)
|
||||
BIO_free(in);
|
||||
if (out)
|
||||
BIO_free(out);
|
||||
BIO_free(in);
|
||||
BIO_free(out);
|
||||
|
||||
return ret;
|
||||
|
||||
|
@ -75,14 +75,10 @@ int main(int argc, char **argv)
|
||||
if (rkey)
|
||||
EVP_PKEY_free(rkey);
|
||||
|
||||
if (in)
|
||||
BIO_free(in);
|
||||
if (out)
|
||||
BIO_free(out);
|
||||
if (tbio)
|
||||
BIO_free(tbio);
|
||||
if (dcont)
|
||||
BIO_free(dcont);
|
||||
BIO_free(in);
|
||||
BIO_free(out);
|
||||
BIO_free(tbio);
|
||||
BIO_free(dcont);
|
||||
|
||||
return ret;
|
||||
|
||||
|
@ -66,12 +66,9 @@ int main(int argc, char **argv)
|
||||
if (rkey)
|
||||
EVP_PKEY_free(rkey);
|
||||
|
||||
if (in)
|
||||
BIO_free(in);
|
||||
if (out)
|
||||
BIO_free(out);
|
||||
if (tbio)
|
||||
BIO_free(tbio);
|
||||
BIO_free(in);
|
||||
BIO_free(out);
|
||||
BIO_free(tbio);
|
||||
|
||||
return ret;
|
||||
|
||||
|
@ -84,14 +84,10 @@ int main(int argc, char **argv)
|
||||
if (recips)
|
||||
sk_X509_pop_free(recips, X509_free);
|
||||
|
||||
if (in)
|
||||
BIO_free(in);
|
||||
if (out)
|
||||
BIO_free(out);
|
||||
if (dout)
|
||||
BIO_free(dout);
|
||||
if (tbio)
|
||||
BIO_free(tbio);
|
||||
BIO_free(in);
|
||||
BIO_free(out);
|
||||
BIO_free(dout);
|
||||
BIO_free(tbio);
|
||||
|
||||
return ret;
|
||||
|
||||
|
@ -80,12 +80,9 @@ int main(int argc, char **argv)
|
||||
if (recips)
|
||||
sk_X509_pop_free(recips, X509_free);
|
||||
|
||||
if (in)
|
||||
BIO_free(in);
|
||||
if (out)
|
||||
BIO_free(out);
|
||||
if (tbio)
|
||||
BIO_free(tbio);
|
||||
BIO_free(in);
|
||||
BIO_free(out);
|
||||
BIO_free(tbio);
|
||||
|
||||
return ret;
|
||||
|
||||
|
@ -76,12 +76,9 @@ int main(int argc, char **argv)
|
||||
if (skey)
|
||||
EVP_PKEY_free(skey);
|
||||
|
||||
if (in)
|
||||
BIO_free(in);
|
||||
if (out)
|
||||
BIO_free(out);
|
||||
if (tbio)
|
||||
BIO_free(tbio);
|
||||
BIO_free(in);
|
||||
BIO_free(out);
|
||||
BIO_free(tbio);
|
||||
|
||||
return ret;
|
||||
|
||||
|
@ -90,12 +90,9 @@ int main(int argc, char **argv)
|
||||
if (skey)
|
||||
EVP_PKEY_free(skey2);
|
||||
|
||||
if (in)
|
||||
BIO_free(in);
|
||||
if (out)
|
||||
BIO_free(out);
|
||||
if (tbio)
|
||||
BIO_free(tbio);
|
||||
BIO_free(in);
|
||||
BIO_free(out);
|
||||
BIO_free(tbio);
|
||||
|
||||
return ret;
|
||||
|
||||
|
@ -45,10 +45,8 @@ int main(int argc, char **argv)
|
||||
if (cms)
|
||||
CMS_ContentInfo_free(cms);
|
||||
|
||||
if (in)
|
||||
BIO_free(in);
|
||||
if (out)
|
||||
BIO_free(out);
|
||||
BIO_free(in);
|
||||
BIO_free(out);
|
||||
|
||||
return ret;
|
||||
|
||||
|
@ -73,12 +73,9 @@ int main(int argc, char **argv)
|
||||
if (cacert)
|
||||
X509_free(cacert);
|
||||
|
||||
if (in)
|
||||
BIO_free(in);
|
||||
if (out)
|
||||
BIO_free(out);
|
||||
if (tbio)
|
||||
BIO_free(tbio);
|
||||
BIO_free(in);
|
||||
BIO_free(out);
|
||||
BIO_free(tbio);
|
||||
|
||||
return ret;
|
||||
|
||||
|
@ -66,12 +66,9 @@ int main(int argc, char **argv)
|
||||
if (rkey)
|
||||
EVP_PKEY_free(rkey);
|
||||
|
||||
if (in)
|
||||
BIO_free(in);
|
||||
if (out)
|
||||
BIO_free(out);
|
||||
if (tbio)
|
||||
BIO_free(tbio);
|
||||
BIO_free(in);
|
||||
BIO_free(out);
|
||||
BIO_free(tbio);
|
||||
|
||||
return ret;
|
||||
|
||||
|
@ -80,12 +80,9 @@ int main(int argc, char **argv)
|
||||
if (recips)
|
||||
sk_X509_pop_free(recips, X509_free);
|
||||
|
||||
if (in)
|
||||
BIO_free(in);
|
||||
if (out)
|
||||
BIO_free(out);
|
||||
if (tbio)
|
||||
BIO_free(tbio);
|
||||
BIO_free(in);
|
||||
BIO_free(out);
|
||||
BIO_free(tbio);
|
||||
|
||||
return ret;
|
||||
|
||||
|
@ -76,12 +76,9 @@ int main(int argc, char **argv)
|
||||
if (skey)
|
||||
EVP_PKEY_free(skey);
|
||||
|
||||
if (in)
|
||||
BIO_free(in);
|
||||
if (out)
|
||||
BIO_free(out);
|
||||
if (tbio)
|
||||
BIO_free(tbio);
|
||||
BIO_free(in);
|
||||
BIO_free(out);
|
||||
BIO_free(tbio);
|
||||
|
||||
return ret;
|
||||
|
||||
|
@ -90,12 +90,9 @@ int main(int argc, char **argv)
|
||||
if (skey)
|
||||
EVP_PKEY_free(skey2);
|
||||
|
||||
if (in)
|
||||
BIO_free(in);
|
||||
if (out)
|
||||
BIO_free(out);
|
||||
if (tbio)
|
||||
BIO_free(tbio);
|
||||
BIO_free(in);
|
||||
BIO_free(out);
|
||||
BIO_free(tbio);
|
||||
|
||||
return ret;
|
||||
|
||||
|
@ -73,12 +73,9 @@ int main(int argc, char **argv)
|
||||
if (cacert)
|
||||
X509_free(cacert);
|
||||
|
||||
if (in)
|
||||
BIO_free(in);
|
||||
if (out)
|
||||
BIO_free(out);
|
||||
if (tbio)
|
||||
BIO_free(tbio);
|
||||
BIO_free(in);
|
||||
BIO_free(out);
|
||||
BIO_free(tbio);
|
||||
|
||||
return ret;
|
||||
|
||||
|
@ -21,13 +21,16 @@ The BIO_new() function returns a new BIO using method B<type>.
|
||||
BIO_set() sets the method of an already existing BIO.
|
||||
|
||||
BIO_free() frees up a single BIO, BIO_vfree() also frees up a single BIO
|
||||
but it does not return a value. Calling BIO_free() may also have some effect
|
||||
but it does not return a value.
|
||||
If B<a> is NULL nothing is done.
|
||||
Calling BIO_free() may also have some effect
|
||||
on the underlying I/O structure, for example it may close the file being
|
||||
referred to under certain circumstances. For more details see the individual
|
||||
BIO_METHOD descriptions.
|
||||
|
||||
BIO_free_all() frees up an entire BIO chain, it does not halt if an error
|
||||
occurs freeing up an individual BIO in the chain.
|
||||
If B<a> is NULL nothing is done.
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
|
@ -656,8 +656,7 @@ static int hwcrhk_finish(ENGINE *e)
|
||||
goto err;
|
||||
}
|
||||
err:
|
||||
if (logstream)
|
||||
BIO_free(logstream);
|
||||
BIO_free(logstream);
|
||||
hwcrhk_dso = NULL;
|
||||
p_hwcrhk_Init = NULL;
|
||||
p_hwcrhk_Finish = NULL;
|
||||
@ -693,10 +692,8 @@ static int hwcrhk_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void))
|
||||
BIO *bio = (BIO *)p;
|
||||
|
||||
CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
|
||||
if (logstream) {
|
||||
BIO_free(logstream);
|
||||
logstream = NULL;
|
||||
}
|
||||
BIO_free(logstream);
|
||||
logstream = NULL;
|
||||
if (CRYPTO_add(&bio->references, 1, CRYPTO_LOCK_BIO) > 1)
|
||||
logstream = bio;
|
||||
else
|
||||
|
@ -404,10 +404,8 @@ static int surewarehk_ctrl(ENGINE *e, int cmd, long i, void *p,
|
||||
{
|
||||
BIO *bio = (BIO *)p;
|
||||
CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
|
||||
if (logstream) {
|
||||
BIO_free(logstream);
|
||||
logstream = NULL;
|
||||
}
|
||||
BIO_free(logstream);
|
||||
logstream = NULL;
|
||||
if (CRYPTO_add(&bio->references, 1, CRYPTO_LOCK_BIO) > 1)
|
||||
logstream = bio;
|
||||
else
|
||||
@ -596,8 +594,7 @@ static int surewarehk_finish(ENGINE *e)
|
||||
goto err;
|
||||
}
|
||||
err:
|
||||
if (logstream)
|
||||
BIO_free(logstream);
|
||||
BIO_free(logstream);
|
||||
surewarehk_dso = NULL;
|
||||
p_surewarehk_Init = NULL;
|
||||
p_surewarehk_Finish = NULL;
|
||||
|
@ -503,10 +503,8 @@ BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx)
|
||||
goto err;
|
||||
return (ret);
|
||||
err:
|
||||
if (buf != NULL)
|
||||
BIO_free(buf);
|
||||
if (ssl != NULL)
|
||||
BIO_free(ssl);
|
||||
BIO_free(buf);
|
||||
BIO_free(ssl);
|
||||
#endif
|
||||
return (NULL);
|
||||
}
|
||||
@ -524,8 +522,7 @@ BIO *BIO_new_ssl_connect(SSL_CTX *ctx)
|
||||
goto err;
|
||||
return (ret);
|
||||
err:
|
||||
if (con != NULL)
|
||||
BIO_free(con);
|
||||
BIO_free(con);
|
||||
#endif
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -558,8 +558,7 @@ int ssl3_enc(SSL *s, int send)
|
||||
|
||||
void ssl3_init_finished_mac(SSL *s)
|
||||
{
|
||||
if (s->s3->handshake_buffer)
|
||||
BIO_free(s->s3->handshake_buffer);
|
||||
BIO_free(s->s3->handshake_buffer);
|
||||
if (s->s3->handshake_dgst)
|
||||
ssl3_free_digest_list(s);
|
||||
s->s3->handshake_buffer = BIO_new(BIO_s_mem());
|
||||
|
10
ssl/s3_lib.c
10
ssl/s3_lib.c
@ -3147,9 +3147,7 @@ void ssl3_free(SSL *s)
|
||||
|
||||
if (s->s3->tmp.ca_names != NULL)
|
||||
sk_X509_NAME_pop_free(s->s3->tmp.ca_names, X509_NAME_free);
|
||||
if (s->s3->handshake_buffer) {
|
||||
BIO_free(s->s3->handshake_buffer);
|
||||
}
|
||||
BIO_free(s->s3->handshake_buffer);
|
||||
if (s->s3->handshake_dgst)
|
||||
ssl3_free_digest_list(s);
|
||||
#ifndef OPENSSL_NO_TLSEXT
|
||||
@ -3200,10 +3198,8 @@ void ssl3_clear(SSL *s)
|
||||
rlen = s->s3->rbuf.len;
|
||||
wlen = s->s3->wbuf.len;
|
||||
init_extra = s->s3->init_extra;
|
||||
if (s->s3->handshake_buffer) {
|
||||
BIO_free(s->s3->handshake_buffer);
|
||||
s->s3->handshake_buffer = NULL;
|
||||
}
|
||||
BIO_free(s->s3->handshake_buffer);
|
||||
s->s3->handshake_buffer = NULL;
|
||||
if (s->s3->handshake_dgst) {
|
||||
ssl3_free_digest_list(s);
|
||||
}
|
||||
|
@ -877,8 +877,7 @@ STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file)
|
||||
}
|
||||
if (sk != NULL)
|
||||
sk_X509_NAME_free(sk);
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
BIO_free(in);
|
||||
if (x != NULL)
|
||||
X509_free(x);
|
||||
if (ret != NULL)
|
||||
@ -938,8 +937,7 @@ int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
|
||||
err:
|
||||
ret = 0;
|
||||
}
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
BIO_free(in);
|
||||
if (x != NULL)
|
||||
X509_free(x);
|
||||
|
||||
|
@ -438,8 +438,7 @@ static int cmd_DHParameters(SSL_CONF_CTX *cctx, const char *value)
|
||||
rv = SSL_set_tmp_dh(cctx->ssl, dh);
|
||||
end:
|
||||
DH_free(dh);
|
||||
if (in)
|
||||
BIO_free(in);
|
||||
BIO_free(in);
|
||||
return rv > 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -543,9 +543,8 @@ void SSL_free(SSL *s)
|
||||
BIO_free(s->bbio);
|
||||
s->bbio = NULL;
|
||||
}
|
||||
if (s->rbio != NULL)
|
||||
BIO_free_all(s->rbio);
|
||||
if ((s->wbio != NULL) && (s->wbio != s->rbio))
|
||||
BIO_free_all(s->rbio);
|
||||
if (s->wbio != s->rbio)
|
||||
BIO_free_all(s->wbio);
|
||||
|
||||
if (s->init_buf != NULL)
|
||||
@ -621,7 +620,7 @@ void SSL_free(SSL *s)
|
||||
|
||||
void SSL_set_rbio(SSL *s, BIO *rbio)
|
||||
{
|
||||
if ((s->rbio != NULL) && (s->rbio != rbio))
|
||||
if (s->rbio != rbio)
|
||||
BIO_free_all(s->rbio);
|
||||
s->rbio = rbio;
|
||||
}
|
||||
@ -637,7 +636,7 @@ void SSL_set_wbio(SSL *s, BIO *wbio)
|
||||
s->bbio->next_bio = NULL;
|
||||
}
|
||||
}
|
||||
if ((s->wbio != NULL) && (s->wbio != wbio) && (s->rbio != s->wbio))
|
||||
if (s->wbio != wbio && s->rbio != s->wbio)
|
||||
BIO_free_all(s->wbio);
|
||||
s->wbio = wbio;
|
||||
}
|
||||
|
@ -121,8 +121,7 @@ int SSL_use_certificate_file(SSL *ssl, const char *file, int type)
|
||||
end:
|
||||
if (x != NULL)
|
||||
X509_free(x);
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
BIO_free(in);
|
||||
return (ret);
|
||||
}
|
||||
#endif
|
||||
@ -262,8 +261,7 @@ int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type)
|
||||
ret = SSL_use_RSAPrivateKey(ssl, rsa);
|
||||
RSA_free(rsa);
|
||||
end:
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
BIO_free(in);
|
||||
return (ret);
|
||||
}
|
||||
# endif
|
||||
@ -335,8 +333,7 @@ int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type)
|
||||
ret = SSL_use_PrivateKey(ssl, pkey);
|
||||
EVP_PKEY_free(pkey);
|
||||
end:
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
BIO_free(in);
|
||||
return (ret);
|
||||
}
|
||||
#endif
|
||||
@ -470,8 +467,7 @@ int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type)
|
||||
end:
|
||||
if (x != NULL)
|
||||
X509_free(x);
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
BIO_free(in);
|
||||
return (ret);
|
||||
}
|
||||
#endif
|
||||
@ -552,8 +548,7 @@ int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type)
|
||||
ret = SSL_CTX_use_RSAPrivateKey(ctx, rsa);
|
||||
RSA_free(rsa);
|
||||
end:
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
BIO_free(in);
|
||||
return (ret);
|
||||
}
|
||||
# endif
|
||||
@ -622,8 +617,7 @@ int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type)
|
||||
ret = SSL_CTX_use_PrivateKey(ctx, pkey);
|
||||
EVP_PKEY_free(pkey);
|
||||
end:
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
BIO_free(in);
|
||||
return (ret);
|
||||
}
|
||||
#endif
|
||||
@ -726,8 +720,7 @@ int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file)
|
||||
end:
|
||||
if (x != NULL)
|
||||
X509_free(x);
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
BIO_free(in);
|
||||
return (ret);
|
||||
}
|
||||
#endif
|
||||
@ -991,8 +984,7 @@ int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file)
|
||||
OPENSSL_free(header);
|
||||
OPENSSL_free(extension);
|
||||
OPENSSL_free(serverinfo);
|
||||
if (bin != NULL)
|
||||
BIO_free(bin);
|
||||
BIO_free(bin);
|
||||
return ret;
|
||||
}
|
||||
# endif /* OPENSSL_NO_STDIO */
|
||||
|
@ -381,13 +381,9 @@ int doit(io_channel chan, SSL_CTX *s_ctx)
|
||||
s_ssl->rbio = NULL;
|
||||
s_ssl->wbio = NULL;
|
||||
|
||||
if (c_to_s != NULL)
|
||||
BIO_free(c_to_s);
|
||||
if (s_to_c != NULL)
|
||||
BIO_free(s_to_c);
|
||||
if (c_bio != NULL)
|
||||
BIO_free(c_bio);
|
||||
if (s_bio != NULL)
|
||||
BIO_free(s_bio);
|
||||
BIO_free(c_to_s);
|
||||
BIO_free(s_to_c);
|
||||
BIO_free(c_bio);
|
||||
BIO_free(s_bio);
|
||||
return (0);
|
||||
}
|
||||
|
@ -1798,8 +1798,7 @@ int main(int argc, char *argv[])
|
||||
SSL_CONF_CTX_free(c_cctx);
|
||||
sk_OPENSSL_STRING_free(conf_args);
|
||||
|
||||
if (bio_stdout != NULL)
|
||||
BIO_free(bio_stdout);
|
||||
BIO_free(bio_stdout);
|
||||
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
free_tmp_rsa();
|
||||
@ -1812,8 +1811,7 @@ int main(int argc, char *argv[])
|
||||
ERR_remove_thread_state(NULL);
|
||||
EVP_cleanup();
|
||||
CRYPTO_mem_leaks(bio_err);
|
||||
if (bio_err != NULL)
|
||||
BIO_free(bio_err);
|
||||
BIO_free(bio_err);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
@ -2173,18 +2171,12 @@ int doit_biopair(SSL *s_ssl, SSL *c_ssl, long count,
|
||||
err:
|
||||
ERR_print_errors(bio_err);
|
||||
|
||||
if (server)
|
||||
BIO_free(server);
|
||||
if (server_io)
|
||||
BIO_free(server_io);
|
||||
if (client)
|
||||
BIO_free(client);
|
||||
if (client_io)
|
||||
BIO_free(client_io);
|
||||
if (s_ssl_bio)
|
||||
BIO_free(s_ssl_bio);
|
||||
if (c_ssl_bio)
|
||||
BIO_free(c_ssl_bio);
|
||||
BIO_free(server);
|
||||
BIO_free(server_io);
|
||||
BIO_free(client);
|
||||
BIO_free(client_io);
|
||||
BIO_free(s_ssl_bio);
|
||||
BIO_free(c_ssl_bio);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -2468,14 +2460,10 @@ int doit(SSL *s_ssl, SSL *c_ssl, long count)
|
||||
c_ssl->wbio = NULL;
|
||||
}
|
||||
|
||||
if (c_to_s != NULL)
|
||||
BIO_free(c_to_s);
|
||||
if (s_to_c != NULL)
|
||||
BIO_free(s_to_c);
|
||||
if (c_bio != NULL)
|
||||
BIO_free_all(c_bio);
|
||||
if (s_bio != NULL)
|
||||
BIO_free_all(s_bio);
|
||||
BIO_free(c_to_s);
|
||||
BIO_free(s_to_c);
|
||||
BIO_free_all(c_bio);
|
||||
BIO_free_all(s_bio);
|
||||
|
||||
if (cbuf)
|
||||
OPENSSL_free(cbuf);
|
||||
|
Loading…
Reference in New Issue
Block a user