[cairo-commit] boilerplate/cairo-boilerplate.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Apr 20 11:08:11 PDT 2007


 boilerplate/cairo-boilerplate.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

New commits:
diff-tree 5135bcf414abc91e7777e2c024c9b6e10bf6115c (from b6be361d0ef3b81ef5cbc28852f323a671e3d030)
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Apr 20 19:08:07 2007 +0100

    cairo-boilerplate - use xmalloc and friends
    
    Prefer to abort gracefully if we run out of memory (or simply to protect
    them from memfault).

diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c
index 1f49e82..2a6d31c 100644
--- a/boilerplate/cairo-boilerplate.c
+++ b/boilerplate/cairo-boilerplate.c
@@ -379,7 +379,7 @@ cairo_boilerplate_get_targets (int *pnum
 		if (0 == strncmp (targets[i].name, tname, end - tname) &&
 		    !isalnum (targets[i].name[end - tname])) {
 		    /* realloc isn't exactly the best thing here, but meh. */
-		    targets_to_test = realloc (targets_to_test, sizeof(cairo_boilerplate_target_t *) * (num_targets+1));
+		    targets_to_test = xrealloc (targets_to_test, sizeof(cairo_boilerplate_target_t *) * (num_targets+1));
 		    targets_to_test[num_targets++] = &targets[i];
 		    found = 1;
 		}
@@ -396,7 +396,7 @@ cairo_boilerplate_get_targets (int *pnum
 	}
     } else {
 	num_targets = sizeof (targets) / sizeof (targets[0]);
-	targets_to_test = malloc (sizeof(cairo_boilerplate_target_t*) * num_targets);
+	targets_to_test = xmalloc (sizeof(cairo_boilerplate_target_t*) * num_targets);
 	for (i = 0; i < num_targets; i++) {
 	    targets_to_test[i] = &targets[i];
 	}


More information about the cairo-commit mailing list