diff options
author | Jeff Morriss <jeff.morriss@ulticom.com> | 2008-02-26 19:03:01 +0000 |
---|---|---|
committer | Jeff Morriss <jeff.morriss@ulticom.com> | 2008-02-26 19:03:01 +0000 |
commit | 1c319c4e2c0f299c9ff9e54726b28221c84cb228 (patch) | |
tree | 3b519f8afbe57bd69120f2421bf40a44a26f0354 | |
parent | 9fdc3e961d7b6c0731ad218095961763428a1baf (diff) |
get_datafile_path() and get_persconffile_path() return malloc'd memory,
free it when we're done with the file name.
svn path=/trunk/; revision=24477
-rw-r--r-- | epan/uat.c | 6 | ||||
-rw-r--r-- | epan/uat_load.l | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/epan/uat.c b/epan/uat.c index e94bb2d9bd..cf891685ae 100644 --- a/epan/uat.c +++ b/epan/uat.c @@ -154,18 +154,24 @@ void uat_remove_record_idx(uat_t* uat, guint idx) { } +/* The returned filename was g_malloc()'d so the caller must free it */ gchar* uat_get_actual_filename(uat_t* uat, gboolean for_writing) { + gchar* pers_fname = get_persconffile_path(uat->filename, TRUE, for_writing); if (! for_writing ) { gchar* data_fname = get_datafile_path(uat->filename); if ((! file_exists(pers_fname) ) && file_exists(data_fname)) { + g_free(pers_fname); return data_fname; } + + g_free(data_fname); } if ((! file_exists(pers_fname) ) && (! for_writing ) ) { + g_free(pers_fname); return NULL; } diff --git a/epan/uat_load.l b/epan/uat_load.l index 42593998d9..ec93d11100 100644 --- a/epan/uat_load.l +++ b/epan/uat_load.l @@ -289,6 +289,7 @@ gboolean uat_load(uat_t* uat_in, char** err) { if (!(yyin = eth_fopen(fname,"r"))) { *err = strerror(errno); + g_free(fname); return FALSE; } @@ -299,6 +300,7 @@ gboolean uat_load(uat_t* uat_in, char** err) { BEGIN START_OF_LINE; DUMP(fname); + g_free(fname); /* we're done with the file name now */ yylex(); yyrestart(NULL); |