Skip to content

Commit

Permalink
Fix free before use in ipropd_master slaves-stats open function
Browse files Browse the repository at this point in the history
Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
  • Loading branch information
Viktor Dukhovni authored and Love Hornquist Astrand committed Apr 24, 2013
1 parent 511cd18 commit eface6d
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions lib/kadm5/ipropd_master.c
Expand Up @@ -813,26 +813,28 @@ static FILE *
open_stats(krb5_context context)
{
char *statfile = NULL;
const char *fn;
int ret;
const char *fn = NULL;
FILE *out = NULL;

/*
* krb5_config_get_string_default() returs default value as-is,
* delay free() of "statfile" until we're done with "fn".
*/
if (slave_stats_file)
fn = slave_stats_file;
else {
ret = asprintf(&statfile, "%s/slaves-stats", hdb_db_dir(context));
if (ret == -1)
return NULL;
else if (asprintf(&statfile, "%s/slaves-stats", hdb_db_dir(context)) != -1
&& statfile != NULL)
fn = krb5_config_get_string_default(context,
NULL,
statfile,
"kdc",
"iprop-stats",
NULL);
if (fn != NULL)
out = fopen(fn, "w");
if (statfile != NULL)
free(statfile);
}
if (fn == NULL)
return NULL;
return fopen(fn, "w");
return out;
}

static void
Expand Down

0 comments on commit eface6d

Please sign in to comment.