Chintan-Dave/UIImageScanlineFloodfill — pull request #10 by Psymiley (2014-02-25 10:27:00+00:00)
Title: Mem alloc calculation error

Error: 'CGContextDrawImage' returns 'EXC_BAD_ACCESS' with some images/sizes.

Observation: Some images have a greater bytesPerRow than assumed (My case: resized image.)

Some instances, bytesPerRow is greater than assumed "width * 4", so using "height * width * 4" would not allocate enough memory for the image.
(i.e my test has 300px width, 4 bytes per px, thus theoretical 1200 bytesPerRow, but CGImageGetBytesPerRow(imageRef) returns 1216.)

As we know the bytesPerRow from the lib, we should use this instead.