File descriptor leaks
Jules Colding <[email protected]> Fri, 11 May 2007 12:53:42 +0200
| Newsgroups | gmane.comp.gnome.evolution.patches |
|---|---|
| Message-ID | <[email protected]> |
Hi, I'm plagued by Evolution leaking file descriptors. I'm currently running 2.8.2.1 on Gentoo, but having the updated svn tree in front of me I digged into that and reviewed it for leaks involving pipe(2). I found a small number of such leaks in the latest svn tree. Most of them was due to a missing close(2) when returning from an error condition. The patch below (#437664) should fix them all. Should I commit to svn? Comments and feedback much appreciated. Best regards, jules Index: plugins/sa-junk-plugin/ChangeLog =================================================================== --- plugins/sa-junk-plugin/ChangeLog (revision 33505) +++ plugins/sa-junk-plugin/ChangeLog (working copy) @@ -1,3 +1,7 @@ +2007-05-11 Jules Colding <[email protected]> + + * em-junk-filter.c (pipe_to_sa_full): File descriptor leaks fixed + 2007-04-03 Srinivasa Ragavan <[email protected]> Added few more plugin callbacks and moved the UI options from core Index: plugins/sa-junk-plugin/em-junk-filter.c =================================================================== --- plugins/sa-junk-plugin/em-junk-filter.c (revision 33505) +++ plugins/sa-junk-plugin/em-junk-filter.c (working copy) @@ -142,6 +142,8 @@ } if (output_buffer && pipe (out_fds) == -1) { + close (fds [0]); + close (fds [1]); errnosav = errno; d(printf ("failed to create a pipe (for use with spamassassin: %s\n", strerror (errno))); errno = errnosav; @@ -175,6 +177,10 @@ errnosav = errno; close (fds[0]); close (fds[1]); + if (output_buffer) { + close (out_fds [0]); + close (out_fds [1]); + } errno = errnosav; return rv_err; } Index: mail/ChangeLog =================================================================== --- mail/ChangeLog (revision 33505) +++ mail/ChangeLog (working copy) @@ -1,3 +1,7 @@ +2007-05-11 Jules Colding <[email protected]> + + * mail-config.c (mail_config_signature_run_script): file descriptor leaks fixed + 2007-05-11 Srinivasa Ragavan <[email protected]> ** Added support for Refresh folder and Flush Outbox functions. Index: mail/mail-config.c =================================================================== --- mail/mail-config.c (revision 33505) +++ mail/mail-config.c (working copy) @@ -1101,6 +1101,8 @@ g_warning ("Could not execute %s: %s\n", script, g_strerror (errno)); _exit (255); } else if (pid < 0) { + close (in_fds [0]); + close (in_fds [1]); g_warning ("Failed to create create child process '%s': %s", script, g_strerror (errno)); return NULL; } else {