ext/RMagick/rmutil.c in rmagick-1.11.0 vs ext/RMagick/rmutil.c in rmagick-1.11.1

- old
+ new

@@ -1,6 +1,6 @@ -/* $Id: rmutil.c,v 1.75 2006/05/07 23:40:14 rmagick Exp $ */ +/* $Id: rmutil.c,v 1.76 2006/05/27 21:05:59 rmagick Exp $ */ /*============================================================================\ | Copyright (C) 2006 by Timothy P. Hunter | Name: rmutil.c | Author: Tim Hunter | Purpose: Utility functions for RMagick @@ -482,10 +482,12 @@ class = class; // defeat "never referenced" message from icc GetExceptionInfo(&exception); okay = QueryColorDatabase(STRING_PTR(name), &pp, &exception); CHECK_EXCEPTION() + DestroyExceptionInfo(&exception); + if (!okay) { rb_raise(rb_eArgError, "invalid color name: %s", STRING_PTR(name)); } @@ -551,10 +553,11 @@ DestroyImageInfo(info); GetExceptionInfo(&exception); (void) QueryColorname(image, pixel, compliance, name, &exception); DestroyImage(image); CHECK_EXCEPTION() + DestroyExceptionInfo(&exception); // Always return a string, even if it's "" return rb_str_new2(name); } @@ -977,10 +980,11 @@ GetExceptionInfo(&exception); (void) QueryColorname(image, color, X11Compliance, name, &exception); CHECK_EXCEPTION() + DestroyExceptionInfo(&exception); return rb_str_new2(name); } /* @@ -2938,10 +2942,11 @@ if (!clone) { rb_raise(rb_eNoMemError, "not enough memory to continue"); } rm_check_exception(&exception, clone, DestroyOnError); + DestroyExceptionInfo(&exception); return clone; } @@ -3138,10 +3143,12 @@ if (badboy) { rm_check_exception(&exception, imglist, retention); } + + DestroyExceptionInfo(&exception); } /* * Extern: rm_check_exception @@ -3196,10 +3203,11 @@ exception->description ? ": " : "", exception->description ? GetLocaleExceptionMessage(exception->severity, exception->description) : ""); msg[sizeof(msg)-1] = '\0'; rb_warning(msg); - DestroyExceptionInfo(exception); + // Caller deletes ExceptionInfo... + return; } // Raise an exception. We're not coming back...