diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-09-02 00:12:43 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-09-02 00:12:43 +0000 |
commit | 51f6d787ac87417a8847567c6d30cdc640ef11ca (patch) | |
tree | c6fbcf7265e7f25dbb40a820b123697cf12ac03c | |
parent | d35fdf3335b14393d33eb8a2da9d6f89c655a15b (diff) | |
download | ruby-51f6d787ac87417a8847567c6d30cdc640ef11ca.tar.gz |
* win32/win32.c (rb_w32_spawn, rb_w32_aspawn): don't forget to free
memory.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | win32/win32.c | 16 |
2 files changed, 17 insertions, 4 deletions
@@ -1,3 +1,8 @@ +Thu Sep 2 09:12:02 2010 NAKAMURA Usaku <usa@ruby-lang.org> + + * 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@ruby-lang.org> * win32/win32.c (CreateChild): unicodize. diff --git a/win32/win32.c b/win32/win32.c index 08ef245b21..631b3e24e1 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1085,7 +1085,8 @@ rb_w32_spawn(int mode, const char *cmd, const char *prog) 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 @@ rb_w32_spawn(int mode, const char *cmd, const char *prog) 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 @@ rb_w32_aspawn(int mode, const char *prog, char *const *argv) 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 @@ rb_w32_aspawn(int mode, const char *prog, char *const *argv) 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 { |