image: Fix crash in _fill_xrgb32_lerp_opaque_spans

If a span length is negative don't go out of bounds processing the fill
data.

Patch thanks to Ilya Sakhnenko <ilia.softway@gmail.com> on mailing list.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
tor-scan-converter: Correctly align 64bit types

On 32bit SPARC the scan converter was causing a SIGBUS due to an unaligned
memory access while accessing an int64_t. This memory accessing was to struct
quorem's rem member.

This crash occurred because the tor-scan-converter contains its own
implementation of a memory pool. This implementation only guarantees an
alignment of sizeof(void *), which is less than what a 64 bit type requires on
32bit platforms. This 4 byte alignment is guaranteed, because struct _pool_chunk
(which is the struct that is used for managing free space) contains elements of
that size and so the size of that struct is a multiple of this size as well.

This problem was introduced with commit 03c3d4b7c15.

To fix this problem, this commit introduces a int64_t member to struct
_pool_chunk that marks the beginning of the free data space. Thanks to this, the
compiler ensures proper alignment and sizeof(struct _pool_chunk) becomes a
multiple of 8.

However, previously the end of the struct marked the beginning of the data and
sizeof() was used for correctly calculating offsets to the data section. So,
just adding such a member would work, but would also waste some memory. To avoid
this, this commit also changes the rest of the pool implementation to
accommodate.

Reported-by: Nicolas Setton <setton@adacore.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
test: Release owned pattern

The pattern created by cairo_pattern_create_rgb() is owned by the
caller, hence it needs to be released.

Fixes the following valgrind error:

malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
_cairo_pattern_create_solid (cairo-pattern.c:605)
_cairo_pattern_create_in_error (cairo-pattern.c:628)
cairo_pop_group (cairo.c:552)
test_cairo_push_group (api-special-cases.c:157)
preamble (api-special-cases.c:1766)
main (cairo-test-runner.c:228)

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
test: Free test list

When running the cairo-test-suite, valgrind reports each of the
registered test as a leak, because they are _list_prepend()'ed, but
the tests list is never _list_free()'d.

Fixes the following valgrind error:

malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
cairo_boilerplate_xmalloc (cairo-boilerplate-system.c:47)
cairo_test_register (cairo-test-runner.c:131)
_cairo_test_runner_register_tests (cairo-test-constructors.c:1112)
main (cairo-test-runner.c:714)

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Merge branch 'master' of git://anongit.freedesktop.org/git/cairo