{"action":"created","issue":{"url":"https://api.github.com/repos/stsp/dosemu2/issues/107","labels_url":"https://api.github.com/repos/stsp/dosemu2/issues/107/labels{/name}","comments_url":"https://api.github.com/repos/stsp/dosemu2/issues/107/comments","events_url":"https://api.github.com/repos/stsp/dosemu2/issues/107/events","html_url":"https://github.com/stsp/dosemu2/issues/107","id":117009969,"number":107,"title":"utilities.c:768: popen2: Assertion `p >= 0' failed.","user":{"login":"jschwartzenberg","id":877112,"avatar_url":"https://avatars.githubusercontent.com/u/877112?v=3","gravatar_id":"","url":"https://api.github.com/users/jschwartzenberg","html_url":"https://github.com/jschwartzenberg","followers_url":"https://api.github.com/users/jschwartzenberg/followers","following_url":"https://api.github.com/users/jschwartzenberg/following{/other_user}","gists_url":"https://api.github.com/users/jschwartzenberg/gists{/gist_id}","starred_url":"https://api.github.com/users/jschwartzenberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jschwartzenberg/subscriptions","organizations_url":"https://api.github.com/users/jschwartzenberg/orgs","repos_url":"https://api.github.com/users/jschwartzenberg/repos","events_url":"https://api.github.com/users/jschwartzenberg/events{/privacy}","received_events_url":"https://api.github.com/users/jschwartzenberg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-11-15T18:37:27Z","updated_at":"2015-11-16T17:05:40Z","closed_at":null,"body":"On Debian Jessie i386 I get the following output after about 1-2 minutes with just a black window when I run DOSEMU.\r\n\r\n  dosemu.bin: utilities.c:768: popen2: Assertion `p >= 0' failed.\r\n  ERROR: fork failed, Resource temporarily unavailable\r\n[boot.log.txt](https://github.com/stsp/dosemu2/files/34956/boot.log.txt)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/stsp/dosemu2/issues/comments/157099674","html_url":"https://github.com/stsp/dosemu2/issues/107#issuecomment-157099674","issue_url":"https://api.github.com/repos/stsp/dosemu2/issues/107","id":157099674,"user":{"login":"andrewbird","id":220835,"avatar_url":"https://avatars.githubusercontent.com/u/220835?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewbird","html_url":"https://github.com/andrewbird","followers_url":"https://api.github.com/users/andrewbird/followers","following_url":"https://api.github.com/users/andrewbird/following{/other_user}","gists_url":"https://api.github.com/users/andrewbird/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewbird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewbird/subscriptions","organizations_url":"https://api.github.com/users/andrewbird/orgs","repos_url":"https://api.github.com/users/andrewbird/repos","events_url":"https://api.github.com/users/andrewbird/events{/privacy}","received_events_url":"https://api.github.com/users/andrewbird/received_events","type":"User","site_admin":false},"created_at":"2015-11-16T17:05:40Z","updated_at":"2015-11-16T17:05:40Z","body":"Mmm it strikes me that there is a resource leak in the error path, but for this to become a problem the second pipe call would have to fail many times.\r\n```C\r\ndiff --git a/src/base/misc/utilities.c b/src/base/misc/utilities.c\r\nindex d9e043d..2437e67 100644\r\n--- a/src/base/misc/utilities.c\r\n+++ b/src/base/misc/utilities.c\r\n@@ -755,7 +755,11 @@ int popen2(const char *cmdline, struct popen2 *childinfo)\r\n     struct timespec to = { 0, 0 };\r\n \r\n     if(pipe(pipe_stdin)) return -1;\r\n-    if(pipe(pipe_stdout)) return -1;\r\n+    if(pipe(pipe_stdout)) {\r\n+        close(pipe_stdin[0]);\r\n+        close(pipe_stdin[1]);\r\n+        return -1;\r\n+    }\r\n \r\n //    printf(\"pipe_stdin[0] = %d, pipe_stdin[1] = %d\\n\", pipe_stdin[0], pipe_stdin[1]);\r\n //    printf(\"pipe_stdout[0] = %d, pipe_stdout[1] = %d\\n\", pipe_stdout[0], pipe_stdout[1]);\r\n```"}}