[PATCH 02/10] os: fix memory leak in Popen

Nicolas PENINGUY nico at lostgeeks.org
Tue Mar 29 16:10:43 PDT 2011


On Tue, 2011-03-29 at 18:12 +0300, Tiago Vignatti wrote:
> +++ b/os/utils.c
> @@ -1315,6 +1315,7 @@ Popen(char *command, char *type)
>      /* Ignore the smart scheduler while this is going on */
>      old_alarm = OsSignal(SIGALRM, SIG_IGN);
>      if (old_alarm == SIG_ERR) {
> +      free(cur);
>        perror("signal");
>        return NULL;
>      }

Shouldn't we close the two file descriptors returned by pipe() in this
case ?

close(pdes[0]);
close(pdes[1]);

(Never used pipe() before so I'm not sure)




More information about the xorg-devel mailing list