ruby-changes:17168
From: usa <ko1@a...>
Date: Thu, 2 Sep 2010 09:12:50 +0900 (JST)
Subject: [ruby-changes:17168] Ruby:r29167 (trunk): * win32/win32.c (rb_w32_spawn, rb_w32_aspawn): don't forget to free
usa 2010-09-02 09:12:43 +0900 (Thu, 02 Sep 2010) New Revision: 29167 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29167 Log: * win32/win32.c (rb_w32_spawn, rb_w32_aspawn): don't forget to free memory. Modified files: trunk/ChangeLog trunk/win32/win32.c Index: ChangeLog =================================================================== --- ChangeLog (revision 29166) +++ ChangeLog (revision 29167) @@ -1,3 +1,8 @@ +Thu Sep 2 09:12:02 2010 NAKAMURA Usaku <usa@r...> + + * win32/win32.c (rb_w32_spawn, rb_w32_aspawn): don't forget to free + memory. + Thu Sep 2 09:01:13 2010 NAKAMURA Usaku <usa@r...> * win32/win32.c (CreateChild): unicodize. Index: win32/win32.c =================================================================== --- win32/win32.c (revision 29166) +++ win32/win32.c (revision 29167) @@ -1085,7 +1085,8 @@ char fbuf[MAXPATHLEN]; char *p = NULL; const char *shell = NULL; - const WCHAR *wcmd, *wshell; + WCHAR *wcmd, *wshell; + rb_pid_t ret; if (check_spawn_mode(mode)) return -1; @@ -1171,7 +1172,10 @@ wcmd = cmd ? acp_to_wstr(cmd, NULL) : NULL; wshell = shell ? acp_to_wstr(shell, NULL) : NULL; - return child_result(CreateChild(wcmd, wshell, NULL, NULL, NULL, NULL), mode); + ret = child_result(CreateChild(wcmd, wshell, NULL, NULL, NULL, NULL), mode); + free(wshell); + free(wcmd); + return ret; } rb_pid_t @@ -1182,7 +1186,8 @@ BOOL ntcmd = FALSE, tmpnt; const char *shell; char *cmd, fbuf[MAXPATHLEN]; - const WCHAR *wcmd, *wprog; + WCHAR *wcmd, *wprog; + rb_pid_t ret; if (check_spawn_mode(mode)) return -1; @@ -1231,7 +1236,10 @@ wcmd = cmd ? acp_to_wstr(cmd, NULL) : NULL; wprog = prog ? acp_to_wstr(prog, NULL) : NULL; - return child_result(CreateChild(wcmd, wprog, NULL, NULL, NULL, NULL), mode); + ret = child_result(CreateChild(wcmd, wprog, NULL, NULL, NULL, NULL), mode); + free(wprog); + free(wcmd); + return ret; } typedef struct _NtCmdLineElement { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/