bug-a2ps
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

a2ps-4.14 bug report with possible fix


From: David Binderman
Subject: a2ps-4.14 bug report with possible fix
Date: Mon, 30 May 2011 19:59:12 +0000


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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]