fix problems found by coverity: remove useless code
This commit is contained in:
parent
a4ff392503
commit
67b6f1ca88
@ -1734,10 +1734,7 @@ CA_DB *load_index(char *dbfile, DB_ATTR *db_attr)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if ((tmpdb = TXT_DB_read(in,DB_NUMBER)) == NULL)
|
if ((tmpdb = TXT_DB_read(in,DB_NUMBER)) == NULL)
|
||||||
{
|
|
||||||
if (tmpdb != NULL) TXT_DB_free(tmpdb);
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef OPENSSL_SYS_VMS
|
#ifndef OPENSSL_SYS_VMS
|
||||||
BIO_snprintf(buf[0], sizeof buf[0], "%s.attr", dbfile);
|
BIO_snprintf(buf[0], sizeof buf[0], "%s.attr", dbfile);
|
||||||
|
@ -148,11 +148,6 @@ static int util_flags(BIO *bio_out, unsigned int flags, const char *indent)
|
|||||||
|
|
||||||
if(flags & ENGINE_CMD_FLAG_NUMERIC)
|
if(flags & ENGINE_CMD_FLAG_NUMERIC)
|
||||||
{
|
{
|
||||||
if(started)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_out, "|");
|
|
||||||
err = 1;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_out, "NUMERIC");
|
BIO_printf(bio_out, "NUMERIC");
|
||||||
started = 1;
|
started = 1;
|
||||||
}
|
}
|
||||||
|
@ -797,8 +797,6 @@ bad:
|
|||||||
|
|
||||||
app_RAND_write_file(randfile, bio_err);
|
app_RAND_write_file(randfile, bio_err);
|
||||||
|
|
||||||
if (pkey == NULL) goto end;
|
|
||||||
|
|
||||||
if (keyout == NULL)
|
if (keyout == NULL)
|
||||||
{
|
{
|
||||||
keyout=NCONF_get_string(req_conf,SECTION,KEYFILE);
|
keyout=NCONF_get_string(req_conf,SECTION,KEYFILE);
|
||||||
|
@ -282,7 +282,7 @@ bad:
|
|||||||
passin, e, "Private Key");
|
passin, e, "Private Key");
|
||||||
|
|
||||||
if (pkey != NULL)
|
if (pkey != NULL)
|
||||||
rsa = pkey == NULL ? NULL : EVP_PKEY_get1_RSA(pkey);
|
rsa = EVP_PKEY_get1_RSA(pkey);
|
||||||
EVP_PKEY_free(pkey);
|
EVP_PKEY_free(pkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,7 +348,7 @@ int MAIN(int, char **);
|
|||||||
int MAIN(int argc, char **argv)
|
int MAIN(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int off=0;
|
int off=0;
|
||||||
SSL *con=NULL,*con2=NULL;
|
SSL *con=NULL;
|
||||||
X509_STORE *store = NULL;
|
X509_STORE *store = NULL;
|
||||||
int s,k,width,state=0;
|
int s,k,width,state=0;
|
||||||
char *cbuf=NULL,*sbuf=NULL,*mbuf=NULL;
|
char *cbuf=NULL,*sbuf=NULL,*mbuf=NULL;
|
||||||
@ -1239,7 +1239,6 @@ shut:
|
|||||||
end:
|
end:
|
||||||
if(prexit) print_stuff(bio_c_out,con,1);
|
if(prexit) print_stuff(bio_c_out,con,1);
|
||||||
if (con != NULL) SSL_free(con);
|
if (con != NULL) SSL_free(con);
|
||||||
if (con2 != NULL) SSL_free(con2);
|
|
||||||
if (ctx != NULL) SSL_CTX_free(ctx);
|
if (ctx != NULL) SSL_CTX_free(ctx);
|
||||||
if (cert)
|
if (cert)
|
||||||
X509_free(cert);
|
X509_free(cert);
|
||||||
|
@ -231,13 +231,11 @@ static int ssl_sock_init(void)
|
|||||||
int init_client(int *sock, char *host, int port, int type)
|
int init_client(int *sock, char *host, int port, int type)
|
||||||
{
|
{
|
||||||
unsigned char ip[4];
|
unsigned char ip[4];
|
||||||
short p=0;
|
|
||||||
|
|
||||||
if (!host_ip(host,&(ip[0])))
|
if (!host_ip(host,&(ip[0])))
|
||||||
{
|
{
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
if (p != 0) port=p;
|
|
||||||
return(init_client_ip(sock,ip,port,type));
|
return(init_client_ip(sock,ip,port,type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,8 +280,6 @@ ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
|
|||||||
return ret;
|
return ret;
|
||||||
err:
|
err:
|
||||||
ASN1err(ASN1_F_D2I_ASN1_OBJECT,i);
|
ASN1err(ASN1_F_D2I_ASN1_OBJECT,i);
|
||||||
if ((ret != NULL) && ((a == NULL) || (*a != ret)))
|
|
||||||
ASN1_OBJECT_free(ret);
|
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
|
ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
|
||||||
|
@ -439,7 +439,7 @@ static int parse_tagging(const char *vstart, int vlen, int *ptag, int *pclass)
|
|||||||
|
|
||||||
static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf)
|
static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf)
|
||||||
{
|
{
|
||||||
ASN1_TYPE *ret = NULL, *typ = NULL;
|
ASN1_TYPE *ret = NULL;
|
||||||
STACK_OF(ASN1_TYPE) *sk = NULL;
|
STACK_OF(ASN1_TYPE) *sk = NULL;
|
||||||
STACK_OF(CONF_VALUE) *sect = NULL;
|
STACK_OF(CONF_VALUE) *sect = NULL;
|
||||||
unsigned char *der = NULL, *p;
|
unsigned char *der = NULL, *p;
|
||||||
@ -455,11 +455,10 @@ static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf)
|
|||||||
goto bad;
|
goto bad;
|
||||||
for (i = 0; i < sk_CONF_VALUE_num(sect); i++)
|
for (i = 0; i < sk_CONF_VALUE_num(sect); i++)
|
||||||
{
|
{
|
||||||
typ = ASN1_generate_v3(sk_CONF_VALUE_value(sect, i)->value, cnf);
|
ASN1_TYPE *typ = ASN1_generate_v3(sk_CONF_VALUE_value(sect, i)->value, cnf);
|
||||||
if (!typ)
|
if (!typ)
|
||||||
goto bad;
|
goto bad;
|
||||||
sk_ASN1_TYPE_push(sk, typ);
|
sk_ASN1_TYPE_push(sk, typ);
|
||||||
typ = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,8 +497,6 @@ static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf)
|
|||||||
|
|
||||||
if (sk)
|
if (sk)
|
||||||
sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free);
|
sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free);
|
||||||
if (typ)
|
|
||||||
ASN1_TYPE_free(typ);
|
|
||||||
if (sect)
|
if (sect)
|
||||||
X509V3_section_free(cnf, sect);
|
X509V3_section_free(cnf, sect);
|
||||||
|
|
||||||
|
@ -70,9 +70,8 @@ static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
|
|||||||
int indent)
|
int indent)
|
||||||
{
|
{
|
||||||
static const char fmt[]="%-18s";
|
static const char fmt[]="%-18s";
|
||||||
static const char fmt2[]="%2d %-15s";
|
|
||||||
char str[128];
|
char str[128];
|
||||||
const char *p,*p2=NULL;
|
const char *p;
|
||||||
|
|
||||||
if (constructed & V_ASN1_CONSTRUCTED)
|
if (constructed & V_ASN1_CONSTRUCTED)
|
||||||
p="cons: ";
|
p="cons: ";
|
||||||
@ -93,14 +92,8 @@ static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
|
|||||||
else
|
else
|
||||||
p = ASN1_tag2str(tag);
|
p = ASN1_tag2str(tag);
|
||||||
|
|
||||||
if (p2 != NULL)
|
if (BIO_printf(bp,fmt,p) <= 0)
|
||||||
{
|
goto err;
|
||||||
if (BIO_printf(bp,fmt2,tag,p2) <= 0) goto err;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (BIO_printf(bp,fmt,p) <= 0) goto err;
|
|
||||||
}
|
|
||||||
return(1);
|
return(1);
|
||||||
err:
|
err:
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -111,7 +111,6 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
|
|||||||
ASN1_INTEGER *bs;
|
ASN1_INTEGER *bs;
|
||||||
EVP_PKEY *pkey=NULL;
|
EVP_PKEY *pkey=NULL;
|
||||||
const char *neg;
|
const char *neg;
|
||||||
ASN1_STRING *str=NULL;
|
|
||||||
|
|
||||||
if((nmflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
|
if((nmflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
|
||||||
mlch = '\n';
|
mlch = '\n';
|
||||||
@ -259,7 +258,6 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
|
|||||||
}
|
}
|
||||||
ret=1;
|
ret=1;
|
||||||
err:
|
err:
|
||||||
if (str != NULL) ASN1_STRING_free(str);
|
|
||||||
if (m != NULL) OPENSSL_free(m);
|
if (m != NULL) OPENSSL_free(m);
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
@ -345,10 +345,7 @@ int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case V_ASN1_BOOLEAN:
|
case V_ASN1_BOOLEAN:
|
||||||
if (it)
|
*(ASN1_BOOLEAN *)pval = it->size;
|
||||||
*(ASN1_BOOLEAN *)pval = it->size;
|
|
||||||
else
|
|
||||||
*(ASN1_BOOLEAN *)pval = -1;
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case V_ASN1_NULL:
|
case V_ASN1_NULL:
|
||||||
|
@ -281,8 +281,8 @@ err:
|
|||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
DSAerr(DSA_F_DSA_SIGN_SETUP,ERR_R_BN_LIB);
|
DSAerr(DSA_F_DSA_SIGN_SETUP,ERR_R_BN_LIB);
|
||||||
if (kinv != NULL) BN_clear_free(kinv);
|
if (r != NULL)
|
||||||
if (r != NULL) BN_clear_free(r);
|
BN_clear_free(r);
|
||||||
}
|
}
|
||||||
if (ctx_in == NULL) BN_CTX_free(ctx);
|
if (ctx_in == NULL) BN_CTX_free(ctx);
|
||||||
if (kinv != NULL) BN_clear_free(kinv);
|
if (kinv != NULL) BN_clear_free(kinv);
|
||||||
|
@ -169,7 +169,6 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
BIO_printf(bio_err,"\ncounter=%d h=%ld\n",counter,h);
|
BIO_printf(bio_err,"\ncounter=%d h=%ld\n",counter,h);
|
||||||
|
|
||||||
if (dsa == NULL) goto end;
|
|
||||||
DSA_print(bio_err,dsa,0);
|
DSA_print(bio_err,dsa,0);
|
||||||
if (counter != 105)
|
if (counter != 105)
|
||||||
{
|
{
|
||||||
|
@ -325,7 +325,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1,
|
|||||||
{
|
{
|
||||||
int spec2len, len;
|
int spec2len, len;
|
||||||
|
|
||||||
spec2len = (filespec2 ? strlen(filespec2) : 0);
|
spec2len = strlen(filespec2);
|
||||||
len = spec2len + (filespec1 ? strlen(filespec1) : 0);
|
len = spec2len + (filespec1 ? strlen(filespec1) : 0);
|
||||||
|
|
||||||
if(filespec2 && filespec2[spec2len - 1] == '/')
|
if(filespec2 && filespec2[spec2len - 1] == '/')
|
||||||
|
@ -740,7 +740,7 @@ void EC_POINT_clear_free(EC_POINT *point)
|
|||||||
|
|
||||||
if (point->meth->point_clear_finish != 0)
|
if (point->meth->point_clear_finish != 0)
|
||||||
point->meth->point_clear_finish(point);
|
point->meth->point_clear_finish(point);
|
||||||
else if (point->meth != NULL && point->meth->point_finish != 0)
|
else if (point->meth->point_finish != 0)
|
||||||
point->meth->point_finish(point);
|
point->meth->point_finish(point);
|
||||||
OPENSSL_cleanse(point, sizeof *point);
|
OPENSSL_cleanse(point, sizeof *point);
|
||||||
OPENSSL_free(point);
|
OPENSSL_free(point);
|
||||||
|
@ -482,8 +482,6 @@ static EVP_PKEY *ibm_4758_load_privkey(ENGINE* e, const char* key_id,
|
|||||||
err:
|
err:
|
||||||
if (keyToken)
|
if (keyToken)
|
||||||
OPENSSL_free(keyToken);
|
OPENSSL_free(keyToken);
|
||||||
if (res)
|
|
||||||
EVP_PKEY_free(res);
|
|
||||||
if (rtmp)
|
if (rtmp)
|
||||||
RSA_free(rtmp);
|
RSA_free(rtmp);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -560,8 +558,6 @@ static EVP_PKEY *ibm_4758_load_pubkey(ENGINE* e, const char* key_id,
|
|||||||
err:
|
err:
|
||||||
if (keyToken)
|
if (keyToken)
|
||||||
OPENSSL_free(keyToken);
|
OPENSSL_free(keyToken);
|
||||||
if (res)
|
|
||||||
EVP_PKEY_free(res);
|
|
||||||
if (rtmp)
|
if (rtmp)
|
||||||
RSA_free(rtmp);
|
RSA_free(rtmp);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -543,7 +543,6 @@ BIO *BIO_new_ssl_connect(SSL_CTX *ctx)
|
|||||||
return(ret);
|
return(ret);
|
||||||
err:
|
err:
|
||||||
if (con != NULL) BIO_free(con);
|
if (con != NULL) BIO_free(con);
|
||||||
if (ret != NULL) BIO_free(ret);
|
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user