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>
This commit is contained in:
parent
b73e812fe7
commit
e9c26d015b
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue