diff options
author | Austin Seipp <austin@well-typed.com> | 2014-04-23 02:14:15 -0500 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2014-04-27 04:18:20 -0500 |
commit | 95da409719bab6f92229dc1a632c471e248d2fdd (patch) | |
tree | ae0a616ecd0d35272566078c8883d0ff31297268 /rts/ProfHeap.c | |
parent | 07388af843ad61757207a54d75ab336606beed4f (diff) | |
download | haskell-95da409719bab6f92229dc1a632c471e248d2fdd.tar.gz |
rts: Fix potential memory leak in ProfHeap.c
Discovered by Coverity. CID 43166.
Signed-off-by: Austin Seipp <austin@well-typed.com>
Diffstat (limited to 'rts/ProfHeap.c')
-rw-r--r-- | rts/ProfHeap.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index d21b14a26d..9079c2be60 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -331,16 +331,17 @@ void initProfiling2 (void) /* Initialise the log file name */ hp_filename = stgMallocBytes(strlen(prog) + 6, "hpFileName"); sprintf(hp_filename, "%s.hp", prog); - + /* open the log file */ if ((hp_file = fopen(hp_filename, "w")) == NULL) { - debugBelch("Can't open profiling report file %s\n", + debugBelch("Can't open profiling report file %s\n", hp_filename); RtsFlags.ProfFlags.doHeapProfile = 0; + stgFree(prog); return; } } - + stgFree(prog); initHeapProfiling(); |