From 888dbe53fda4026fd4e591a38ccbdfe276e0a608 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Wed, 3 Jul 2013 09:45:15 -0400 Subject: [PATCH] Fix up uses of talloc and change one malloc to talloc --- src/main/conffile.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/conffile.c b/src/main/conffile.c index 03f6c62..f3b52cd 100644 --- a/src/main/conffile.c +++ b/src/main/conffile.c @@ -217,7 +217,9 @@ static int cf_data_free(void *ctx) CONF_DATA *cd; cd = talloc_get_type_abort(ctx, CONF_DATA); - cd->free(cd->data); + if (cd->free) { + cd->free(cd->data); + } return 0; } @@ -1047,7 +1049,7 @@ int cf_item_parse(CONF_SECTION *cs, char const *name, int type, void *data, char *mtime = buf.st_mtime; /* FIXME: error? */ - cf_data_add_internal(cs, *q, mtime, free, type); + cf_data_add_internal(cs, *q, mtime, NULL, type); /* * We were expecting the file to exist... */ @@ -1914,10 +1916,10 @@ int cf_file_include(CONF_SECTION *cs, char const *filename) /* * Add the filename to the section */ - mtime = rad_malloc(sizeof(*mtime)); + mtime = talloc(cs, time_t); *mtime = statbuf.st_mtime; - if (cf_data_add_internal(cs, filename, mtime, free, PW_TYPE_FILE_INPUT) < 0) { + if (cf_data_add_internal(cs, filename, mtime, NULL, PW_TYPE_FILE_INPUT) < 0) { fclose(fp); ERROR("Internal error opening file \"%s\"", filename); -- 2.1.4