diff options
author | Simon Jakobi <simon.jakobi@gmail.com> | 2018-02-20 13:17:50 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-02-25 16:25:19 -0500 |
commit | be498a24250f637471426989b3bdf5f1b18e47bb (patch) | |
tree | d420d0bfa2d820c4e2c696f4e824ee5d5787f316 | |
parent | c969c987ab63db29f305f9a0fd2047bc8156f309 (diff) | |
download | haskell-be498a24250f637471426989b3bdf5f1b18e47bb.tar.gz |
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
-rw-r--r-- | rts/win32/IOManager.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/rts/win32/IOManager.c b/rts/win32/IOManager.c index c5cae75366..216e7253e8 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 */ |