[cups.development] found a resource leak in file socket.c

Michael R Sweet msweet at apple.com
Tue Jun 30 13:39:54 PDT 2009


Martin Ettl wrote:
> Hi all,
> 
> i have checked the sources of cups with the static code analysis tool cppcheck. It found a resource leak in file socket.c at line 259. The tool prints the following output:
> 
>  [cups-1.3.10/backend/socket.c:259]: (error) Resource leak: print_fd
> 
> Take a look at the sourcecode to line 259:

Indeed, the backend does not close a file before it exits...  However,
since the OS is good about closing file descriptors on exit (and
freeing all memory that was used, etc.), this is not a bug.

(I'd file a bug against cppcheck - return from main is equivalent to
exit, so resource leaks like this should never be reported...)

-- 
______________________________________________________________________
Michael R Sweet                        Senior Printing System Engineer





More information about the cups-devel mailing list