Skip to content

Commit

Permalink
Merge pull request #43 from chipb/xrandr-XFree-fixes
Browse files Browse the repository at this point in the history
Xrandr XFree() fixes
  • Loading branch information
pjones authored Dec 14, 2016
2 parents 8222cc8 + 1a0c7b3 commit 709d183
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Graphics/X11/Xrandr.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ xrrConfigSizes config =
sizes <- if nsizes == 0
then return Nothing
else peekArray (fromIntegral nsizes) p >>= return . Just
_ <- xFree p
return sizes
foreign import ccall "XRRConfigSizes"
cXRRConfigSizes :: XRRScreenConfiguration -> Ptr CInt -> IO (Ptr XRRScreenSize)
Expand All @@ -433,7 +432,6 @@ xrrConfigRates config size_index =
rates <- if nrates == 0
then return Nothing
else peekArray (fromIntegral nrates) p >>= return . Just
_ <- xFree p
return rates
foreign import ccall "XRRConfigRates"
cXRRConfigRates :: XRRScreenConfiguration -> CInt -> Ptr CInt -> IO (Ptr CShort)
Expand Down Expand Up @@ -486,7 +484,6 @@ xrrSizes dpy screen =
sizes <- if nsizes == 0
then return Nothing
else peekArray (fromIntegral nsizes) p >>= return . Just
_ <- xFree p
return sizes
foreign import ccall "XRRSizes"
cXRRSizes :: Display -> CInt -> Ptr CInt -> IO (Ptr XRRScreenSize)
Expand All @@ -501,7 +498,6 @@ xrrRates dpy screen size_index =
rates <- if nrates == 0
then return Nothing
else peekArray (fromIntegral nrates) p >>= return . Just
_ <- xFree p
return rates
foreign import ccall "XRRRates"
cXRRRates :: Display -> CInt -> CInt -> Ptr CInt -> IO (Ptr CShort)
Expand Down Expand Up @@ -680,7 +676,9 @@ xrrGetOutputProperty dpy rro prop offset len delete preferPending reqType = with
32 -> peekArray nitems (castPtr ptr :: Ptr Word32)
_ -> error $ "impossible happened: prop format is not in 0,8,16,32 (" ++ show format ++ ")"

_ <- xFree ptr
_ <- if format /= 0
then xFree ptr
else return 0

typ <- peek actualTypep
bytesAfter <- peek bytesAfterp
Expand Down

0 comments on commit 709d183

Please sign in to comment.