Skip to content

Commit

Permalink
Avoid XFree() when not returned allocated memory
Browse files Browse the repository at this point in the history
When returned format == 0, the property lookup has returned nothing, so
there is no memory to free.
  • Loading branch information
chipb committed Mar 27, 2016
1 parent cb5087e commit 1a0c7b3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Graphics/X11/Xrandr.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -676,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 1a0c7b3

Please sign in to comment.