[cups.bugs] [BUG] deallocating an allready deallocated file pointer in file backend/scsi.c

Michael R Sweet msweet at apple.com
Sun Aug 2 09:43:44 PDT 2009


Please report this bug using the form at:

     http://www.cups.org/str.php

Ettl Martin wrote:
> Hello friends,
> 
> i have checked the sources of cups with the static code analysis tool cppcheck. If found an issue in file backend/scsi.c. The tool prints the following message:
> 
> ./backend/scsi.c,221,error,Deallocating a deallocated pointer: fp
> 
> Take a look at the code:
> ...
> 214  status = print_device(resource, fp, copies);
> 
>  /*
>   * Close input file and return...
>   */
> 
> 220  if (fp != 0)
> 221    close(fp);
> ..
> 
> The file pointer is allready closed during the function call of print_device(..,fp,..). print_dev is declared in file scsi-linux.c.
> So, the static code analysis tool is right. This is a bug.

True, however in this case the likelihood of it causing a problem is
tiny since the second close of the file *descriptor* will just fail
since we never open another file that would get the same fd.

-- 
______________________________________________________________________
Michael R Sweet                        Senior Printing System Engineer





More information about the cups-devel mailing list