mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 15:00:12 +00:00
comerr: Fix problems found by static analysis
Several static analysis tools have identified various problems: - files left open from early returns/exits (infer) - possible memory leaks (scan-build, cppcheck) To resolve the above problems: - close files before returning/exiting - fix possible memory leaks by freeing memory This commit is a reorganization of commits developed by Pat Riehecky, who ran the static analysis tools and developed the fixes. Change-Id: Id8d25bacd2d1e1dee32354248519e3821ffe726c Reviewed-on: https://gerrit.openafs.org/14681 Reviewed-by: Cheyenne Wills <cwills@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
This commit is contained in:
parent
387ab140f5
commit
6531aba22d
@ -307,6 +307,9 @@ main(int argc, char **argv)
|
||||
sprintf(h_file, "%s.h", ename);
|
||||
}
|
||||
}
|
||||
free(ename);
|
||||
ename = NULL;
|
||||
|
||||
p = strrchr(filename, '.');
|
||||
if (p == NULL) {
|
||||
p = xmalloc(strlen(filename) + 4);
|
||||
@ -326,6 +329,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
free(et_file);
|
||||
et_file = NULL;
|
||||
|
||||
/* on NT, yyout is not initialized to stdout */
|
||||
if (!yyout) {
|
||||
@ -371,6 +375,7 @@ main(int argc, char **argv)
|
||||
} while (count > 0);
|
||||
fprintf(hfile, "\n/* End of prolog file %s. */\n\n",
|
||||
prolog_h_file);
|
||||
fclose(prolog_hfile);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user