[commit: ghc] master: RTS: Remember to free some pointers (be498a2)
git at git.haskell.org
git at git.haskell.org
Sun Feb 25 21:57:45 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/be498a24250f637471426989b3bdf5f1b18e47bb/ghc
>---------------------------------------------------------------
commit be498a24250f637471426989b3bdf5f1b18e47bb
Author: Simon Jakobi <simon.jakobi at gmail.com>
Date: Tue Feb 20 13:17:50 2018 -0500
RTS: Remember to free some pointers
Reviewers: bgamari, erikd, simonmar
Reviewed By: bgamari, simonmar
Subscribers: Phyx, rwbarton, thomie, carter
GHC Trac Issues: #11777
Differential Revision: https://phabricator.haskell.org/D4428
>---------------------------------------------------------------
be498a24250f637471426989b3bdf5f1b18e47bb
rts/win32/IOManager.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/rts/win32/IOManager.c b/rts/win32/IOManager.c
index c5cae75..216e725 100644
--- a/rts/win32/IOManager.c
+++ b/rts/win32/IOManager.c
@@ -437,7 +437,10 @@ AddIORequest ( int fd,
{
WorkItem* wItem = (WorkItem*)malloc(sizeof(WorkItem));
unsigned int reqID;
- if (!ioMan || !wItem) return 0;
+ if (!ioMan || !wItem) {
+ free(wItem);
+ return 0;
+ }
reqID = ioMan->requestID++;
/* Fill in the blanks */
@@ -466,7 +469,10 @@ AddDelayRequest ( HsInt usecs,
{
WorkItem* wItem = (WorkItem*)malloc(sizeof(WorkItem));
unsigned int reqID;
- if (!ioMan || !wItem) return false;
+ if (!ioMan || !wItem) {
+ free(wItem);
+ return false;
+ }
reqID = ioMan->requestID++;
/* Fill in the blanks */
@@ -491,7 +497,10 @@ AddProcRequest ( void* proc,
{
WorkItem* wItem = (WorkItem*)malloc(sizeof(WorkItem));
unsigned int reqID;
- if (!ioMan || !wItem) return false;
+ if (!ioMan || !wItem) {
+ free(wItem);
+ return false;
+ }
reqID = ioMan->requestID++;
/* Fill in the blanks */
More information about the ghc-commits
mailing list