[Xcb] [PATCH] util-cursor: Fix minor memleak and fix the RENDER version check
Uli Schlachter
psychon at znc.in
Thu Sep 19 10:09:01 PDT 2013
Hi,
On 19.09.2013 18:47, Bart Massey wrote:
> I'm confused about the first patch. Shouldn't you be checking whether
> the resource string is null before freeing it, rather than freeing it
> unconditionally?
free(NULL) is fine. First result for "free null" on Google is:
http://stackoverflow.com/questions/1938735/does-freeptr-where-ptr-is-null-corrupt-memory
Or, quoting free(3) (the part about free):
If ptr is NULL, no operation is performed.
Really, everyone who writes something like if (foo != NULL) free(foo); should be
taught this.
According to other Google results, even c89 says this already.
> Second patch looks fine.
> Reviewed-By: Bart Massey <bart at cs.pdx.edu>
Thanks :-)
Uli
> On Thu, Sep 19, 2013 at 9:21 AM, Uli Schlachter <psychon at znc.in> wrote:
> Hi,
>
> attached are two patches for util-cursor. The first one handles a minor memory
> leak and is quite trivial.
>
> The second one is a little less trivial: CreateCursor was added to RENDER in
> version 0.5 and CreateAnimCursor is new in version 0.8. However, util-cursor
> only checked if the RENDER extension is present and then assumed that all
> requests are available.
[...]
--
"For saving the Earth.. and eating cheesecake!"
More information about the Xcb
mailing list