summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gd_gd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gd_gd.c b/src/gd_gd.c
index 0771fd3..ebbe156 100644
--- a/src/gd_gd.c
+++ b/src/gd_gd.c
@@ -400,8 +400,11 @@ BGD_DECLARE(void *) gdImageGdPtr (gdImagePtr im, int *size)
void *rv;
gdIOCtx *out = gdNewDynamicCtx (2048, NULL);
if (out == NULL) return NULL;
- _gdImageGd (im, out);
- rv = gdDPExtractData (out, size);
+ if (_gdImageGd (im, out)) {
+ rv = NULL;
+ } else {
+ rv = gdDPExtractData(out, size);
+ }
out->gd_free (out);
return rv;
}