aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/file_access.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-11-24 21:38:05 -0800
committerGuy Harris <guy@alum.mit.edu>2015-11-25 05:38:34 +0000
commite9c26d015bde3ca5e5bf858ddb266a70d6751b7d (patch)
tree2c10a52f3815892c6464c0e914c66fe166735ed7 /wiretap/file_access.c
parentb73e812fe7c50fb717da180de2191c335ab554d7 (diff)
Check whether create_tempfile() fails.
Thanks and a tip of the Hatlo hat to Coverity for finding this. Change-Id: Ie9d4089443e52ef427e0cc8ae6e90a9d9787134e Reviewed-on: https://code.wireshark.org/review/12123 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/file_access.c')
-rw-r--r--wiretap/file_access.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/wiretap/file_access.c b/wiretap/file_access.c
index eae4fb2bfa..cb10953f9d 100644
--- a/wiretap/file_access.c
+++ b/wiretap/file_access.c
@@ -2272,6 +2272,11 @@ wtap_dump_open_tempfile_ng(char **filenamep, const char *pfx,
/* Choose a random name for the file */
fd = create_tempfile(&tmpname, pfx);
+ if (fd == -1) {
+ *err = errno;
+ g_free(wdh);
+ return NULL; /* can't create file */
+ }
*filenamep = tmpname;
/* In case "fopen()" fails but doesn't set "errno", set "errno"