Fix memory leaks.

This commit is contained in:
Dr. Stephen Henson 2001-06-19 17:13:48 +00:00
parent b7fe2f9675
commit a45e4a5537

View File

@ -183,14 +183,12 @@ static int util_verbose(ENGINE *e, int verbose, BIO *bio_out, const char *indent
{ {
static const int line_wrap = 78; static const int line_wrap = 78;
int num; int num;
int ret = 0;
char *name = NULL; char *name = NULL;
char *desc = NULL; char *desc = NULL;
int flags; int flags;
int xpos = 0; int xpos = 0;
STACK *cmds = sk_new_null(); STACK *cmds = NULL;
if(!cmds)
goto err;
if(!ENGINE_ctrl(e, ENGINE_CTRL_HAS_CTRL_FUNCTION, 0, NULL, NULL) || if(!ENGINE_ctrl(e, ENGINE_CTRL_HAS_CTRL_FUNCTION, 0, NULL, NULL) ||
((num = ENGINE_ctrl(e, ENGINE_CTRL_GET_FIRST_CMD_TYPE, ((num = ENGINE_ctrl(e, ENGINE_CTRL_GET_FIRST_CMD_TYPE,
0, NULL, NULL)) <= 0)) 0, NULL, NULL)) <= 0))
@ -200,6 +198,11 @@ static int util_verbose(ENGINE *e, int verbose, BIO *bio_out, const char *indent
#endif #endif
return 1; return 1;
} }
cmds = sk_new_null();
if(!cmds)
goto err;
do { do {
int len; int len;
/* Get the command name */ /* Get the command name */
@ -264,12 +267,12 @@ static int util_verbose(ENGINE *e, int verbose, BIO *bio_out, const char *indent
} while(num > 0); } while(num > 0);
if(xpos > 0) if(xpos > 0)
BIO_printf(bio_out, "\n"); BIO_printf(bio_out, "\n");
return 1; ret = 1;
err: err:
if(cmds) sk_pop_free(cmds, identity); if(cmds) sk_pop_free(cmds, identity);
if(name) OPENSSL_free(name); if(name) OPENSSL_free(name);
if(desc) OPENSSL_free(desc); if(desc) OPENSSL_free(desc);
return 0; return ret;
} }
static void util_do_cmds(ENGINE *e, STACK *cmds, BIO *bio_out, const char *indent) static void util_do_cmds(ENGINE *e, STACK *cmds, BIO *bio_out, const char *indent)