summaryrefslogtreecommitdiff
path: root/rts/RtsStartup.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2011-05-25 10:00:29 +0100
committerSimon Marlow <marlowsd@gmail.com>2011-05-25 13:09:47 +0100
commita6e8418a71b14ef85ee7134be654689b17765f03 (patch)
tree8094503174122b76e574baadcf02f046fd7732df /rts/RtsStartup.c
parentf61d53d322cdf81a1cfa09cf4a4af4198611bcd5 (diff)
downloadhaskell-a6e8418a71b14ef85ee7134be654689b17765f03.tar.gz
prog_argv and rts_argv now contain *copies* of the args passed to
setupRtsFlags(), rather than sharing the memory. Previously if the caller of hs_init() passed in dynamically-allocated memory and then freed it, random crashes could happen later (#5177).
Diffstat (limited to 'rts/RtsStartup.c')
-rw-r--r--rts/RtsStartup.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c
index 236d07a9e0..952e806345 100644
--- a/rts/RtsStartup.c
+++ b/rts/RtsStartup.c
@@ -297,9 +297,6 @@ hs_exit_(rtsBool wait_foreign)
checkFPUStack();
#endif
- // Free the full argv storage
- freeFullProgArgv();
-
#if defined(THREADED_RTS)
ioManagerDie();
#endif
@@ -402,6 +399,8 @@ hs_exit_(rtsBool wait_foreign)
// heap memory (e.g. by being passed a ByteArray#).
freeStorage(wait_foreign);
+ // Free the various argvs
+ freeRtsArgs();
}
// The real hs_exit():