diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-12-28 02:28:27 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-12-28 10:28:56 +0000 |
commit | 9fce4dd4cb47965870d870b77983f8d2c501c810 (patch) | |
tree | c5aa514c998e9ce4b4e5deeab4d27146ce88cc17 | |
parent | 120628e5f478a4ee767f87c2b408edb0ed5224ba (diff) | |
download | wireshark-9fce4dd4cb47965870d870b77983f8d2c501c810.tar.gz |
If we can't open the GeoIP database, close and unlink the map file.
We can't write out the full map file, and we return an error, so just
get rid of the file.
Fixes Coverity CID 1256521.
Change-Id: Ieee078f760c035d65b2fce199ea472ba915be9c6
Reviewed-on: https://code.wireshark.org/review/6090
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | ui/traffic_table_ui.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ui/traffic_table_ui.c b/ui/traffic_table_ui.c index c6c65b73d5..26e2205b6c 100644 --- a/ui/traffic_table_ui.c +++ b/ui/traffic_table_ui.c @@ -41,6 +41,9 @@ #include <errno.h> #include <stdio.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif #include "wsutil/filesystem.h" #include "wsutil/file_util.h" #include "wsutil/tempfile.h" @@ -180,6 +183,9 @@ create_endpoint_geoip_map(const GArray *endp_array, gchar **err_str) { if (err_str) { *err_str = g_strdup("Unable to open GeoIP database"); } + /* We can't write the map file, so close it and get rid of it */ + fclose(out_file); + ws_unlink(map_filename); g_free(map_filename); fclose(tpl_file); return NULL; |