aboutsummaryrefslogtreecommitdiffstats
path: root/filters.c
diff options
context:
space:
mode:
authormorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>2008-02-26 19:13:43 +0000
committermorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>2008-02-26 19:13:43 +0000
commit9c57cec010977543958a32c00113af52546bc727 (patch)
treea7928b496c8ef177b2d0cf6f9b3ab9ddaeaa8216 /filters.c
parenteb78d1391b5b018ad45714189ab79ba443de9dac (diff)
get_datafile_path() and get_persconffile_path() return malloc'd memory,
free it when we're done with the file name. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24478 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'filters.c')
-rw-r--r--filters.c49
1 files changed, 26 insertions, 23 deletions
diff --git a/filters.c b/filters.c
index 71d177135b..c13947ffe6 100644
--- a/filters.c
+++ b/filters.c
@@ -170,33 +170,36 @@ read_filter_list(filter_list_type_t list_type, char **pref_path_return,
g_free(ff_path);
ff_path = get_persconffile_path(FILTER_FILE_NAME, FALSE, FALSE);
if ((ff = eth_fopen(ff_path, "r")) == NULL) {
- /*
- * Did that fail because the file didn't exist?
- */
- if (errno != ENOENT) {
/*
- * No. Just give up.
+ * Did that fail because the file didn't exist?
*/
- *pref_path_return = ff_path;
- *errno_return = errno;
- return;
- }
-
- /*
- * Try to open the global "cfilters/dfilters" file */
- ff_path = get_datafile_path(ff_name);
- if ((ff = eth_fopen(ff_path, "r")) == NULL) {
+ if (errno != ENOENT) {
+ /*
+ * No. Just give up.
+ */
+ *pref_path_return = ff_path;
+ *errno_return = errno;
+ return;
+ }
/*
- * Well, that didn't work, either. Just give up.
- * Return an error if the file existed but we couldn't open it.
- */
- if (errno != ENOENT) {
- *pref_path_return = ff_path;
- *errno_return = errno;
- }
- return;
- }
+ * Try to open the global "cfilters/dfilters" file */
+ g_free(ff_path);
+ ff_path = get_datafile_path(ff_name);
+ if ((ff = eth_fopen(ff_path, "r")) == NULL) {
+
+ /*
+ * Well, that didn't work, either. Just give up.
+ * Return an error if the file existed but we couldn't open it.
+ */
+ if (errno != ENOENT) {
+ *pref_path_return = ff_path;
+ *errno_return = errno;
+ } else {
+ g_free(ff_path);
+ }
+ return;
+ }
}
}