Commit 063b822b authored by Simon Marlow's avatar Simon Marlow
Browse files

Free full_prog_argv at exit, closing a memory leak

parent cf036e5b
......@@ -48,6 +48,7 @@ extern void getProgArgv ( int *argc, char **argv[] );
extern void setProgArgv ( int argc, char *argv[] );
extern void getFullProgArgv ( int *argc, char **argv[] );
extern void setFullProgArgv ( int argc, char *argv[] );
extern void freeFullProgArgv ( void ) ;
#ifndef mingw32_HOST_OS
extern void shutdownHaskellAndSignal (int sig);
......
......@@ -1389,3 +1389,18 @@ setFullProgArgv(int argc, char *argv[])
full_prog_argv[argc] = NULL;
}
void
freeFullProgArgv (void)
{
int i;
if (full_prog_argv != NULL) {
for (i = 0; i < full_prog_argc; i++) {
stgFree(full_prog_argv[i]);
}
stgFree(full_prog_argv);
}
full_prog_argc = 0;
full_prog_argv = NULL;
}
......@@ -338,6 +338,9 @@ hs_exit_(rtsBool wait_foreign)
OnExitHook();
// Free the full argv storage
freeFullProgArgv();
#if defined(THREADED_RTS)
ioManagerDie();
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment