diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-09-11 12:55:15 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-09-17 08:33:11 -0700 |
commit | f5cb430f246850e8213fe5cd95b4ea44228f3c3b (patch) | |
tree | 1e415cf84e7b6c37bfabc1d887c13969613850e4 | |
parent | 776e7c4dae63e2541a6f3822c3e9d659f9af101e (diff) |
Avoid leak of new_file if we decide not to use it
As warned by cppcheck:
xditview.c:338:13: error: Resource leak: new_file [resourceLeak]
return;
^
xditview.c:342:13: error: Resource leak: new_file [resourceLeak]
return;
^
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | xditview.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -335,10 +335,12 @@ VisitFile (char *name, Boolean resetPage) /* Make sure it is a regular file */ if (fstat(fileno(new_file), &stbuf) != 0) { perror(name); + fclose(new_file); return; } if (! S_ISREG(stbuf.st_mode)){ fprintf(stderr, "%s is not a regular file.\n", name); + fclose(new_file); return; } |