[pdf] Fixup a couple of inverted tests.

Check for NULL returns from malloc, instead of reporting errors and
leaking on success.
This commit is contained in:
Chris Wilson 2008-08-06 10:51:34 +01:00
parent 7ffd8bbcb0
commit 2dfee9986c

View file

@ -4783,8 +4783,8 @@ _cairo_pdf_surface_show_text_glyphs (void *abstract_surface,
group->source_res = pattern_res;
if (utf8_len) {
group->utf8 = malloc(utf8_len);
if (group->utf8) {
group->utf8 = malloc (utf8_len);
if (group->utf8 == NULL) {
_cairo_pdf_smask_group_destroy (group);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
@ -4804,7 +4804,7 @@ _cairo_pdf_surface_show_text_glyphs (void *abstract_surface,
if (num_clusters) {
group->clusters = _cairo_malloc_ab (num_clusters, sizeof (cairo_text_cluster_t));
if (group->clusters) {
if (group->clusters == NULL) {
_cairo_pdf_smask_group_destroy (group);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}