[cairo] libpixman leak (fwd)
sandmann at daimi.au.dk
Thu Apr 24 11:28:19 PDT 2008
Michael Natterer <mitch at imendio.com> writes:
> The problem here is that if the function gets called with n = 0,
> then region->data->size will be 0, which makes it look as if
> it was the statically allocated _pixman_region_emptyBox.
> But in fact, region->data = allocData(0); *does* allocate
> memory, since PIXREGION_SZOF(0), which is called from allocData(0),
> returns sizeof(pixman_region16_data_t).
> So each time pixman_rect_alloc() is called with n = 0, we leak
> a memory block of sizeof(pixman_region16_data_t).
I guess one question is, when do we call pixman_rect_alloc() with n ==
0? Looking over the code, it looks like most places are careful to not
allocate if the number of rectangles are n.
The region code is old and unpleasent, but also very well tested, so
changing it needs to be done carefully.
A standalone testcase demonstrating a leak would be very helpful.
More information about the cairo