unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* execl, execlp memory leak
@ 2004-02-24 22:40 Kevin Ryde
  2004-02-25  7:33 ` Marius Vollmer
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Ryde @ 2004-02-24 22:40 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 218 bytes --]

        * posix.c (scm_execl, scm_execlp): Avoid memory leak under error throw.

This can be seen with for instance

	(while #t
	  (false-if-exception
	   (execl "nosuchprog")))

This would be for the 1.6 branch too.


[-- Attachment #2: posix.c.exec-leak.diff --]
[-- Type: text/plain, Size: 821 bytes --]

--- posix.c.~1.125.~	2004-02-22 07:54:37.000000000 +1000
+++ posix.c	2004-02-24 19:37:00.000000000 +1000
@@ -909,9 +909,13 @@
 #define FUNC_NAME s_scm_execl
 {
   char **execargv;
+  int save_errno;
   SCM_VALIDATE_STRING (1, filename);
   execargv = allocate_string_pointers (args);
   execv (SCM_STRING_CHARS (filename), execargv);
+  save_errno = errno;
+  free (execargv);
+  errno = save_errno;
   SCM_SYSERROR;
   /* not reached.  */
   return SCM_BOOL_F;
@@ -929,9 +933,13 @@
 #define FUNC_NAME s_scm_execlp
 {
   char **execargv;
+  int save_errno;
   SCM_VALIDATE_STRING (1, filename);
   execargv = allocate_string_pointers (args);
   execvp (SCM_STRING_CHARS (filename), execargv);
+  save_errno = errno;
+  free (execargv);
+  errno = save_errno;
   SCM_SYSERROR;
   /* not reached.  */
   return SCM_BOOL_F;

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-02-25  7:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-24 22:40 execl, execlp memory leak Kevin Ryde
2004-02-25  7:33 ` Marius Vollmer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).