a2ps-4.14 bug report with possible fix
David Binderman <[email protected]> Mon, 30 May 2011 19:59:12 +0000
| Newsgroups | gmane.comp.printing.a2ps.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hello there,
I just ran static analysis tool cppcheck over the source code of a2ps-4.14
It said
[src/main.c:594]: (error) Deallocating a deallocated pointer: spy
The source code is
fclose (spy);
fopen (spyname, "r");
if (!spy)
error (1, errno, _("cannot open file `%s'"), quotearg (spyname));
It looks to me like the result of the call to
fopen doesn't go into any local variable. Suggest new code
fclose (spy);
spy = fopen (spyname, "r"); /* New code */
if (!spy)
error (1, errno, _("cannot open file `%s'"), quotearg (spyname));
Regards
David Binderman