]> git.draconx.ca Git - liblbx.git/commit
liblbx: Fix framebuffer allocation for 0x0 images.
authorNick Bowler <nbowler@draconx.ca>
Fri, 21 Jun 2013 14:22:48 +0000 (10:22 -0400)
committerNick Bowler <nbowler@draconx.ca>
Sat, 22 Jun 2013 13:56:37 +0000 (09:56 -0400)
commit5057c6695cbe55f5d13e8e10a1e630c7ee00ea12
tree01811e0041385a4ce4c6fec3f005040765793a8d
parentd4c47ce48c5de8bd1066ae3996f6e34cd790cd7c
liblbx: Fix framebuffer allocation for 0x0 images.

The allocation strategy for the framebuffer is the "array2" method from
c-faq: an array of row pointers into a single large array containing all
rows.  This was not being freed correctly in the case with 0 rows, since
there would be no pointer to the row data at all in order to free it.

Fix that up by simply allocating a 1x1 framebuffer when it would
otherwise be empty.  While we're at it, also add an overflow check
on the multiplication.
src/image.c
tests/empty-image.tap