Anonymous avatar Anonymous committed 4b5a9f8

fixed possible segfaults when gdNewDynamicCtx() returns null

Comments (0)

Files changed (9)

 {
 	void *rv;
 	gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
+	if (out == NULL) return NULL;
 	gdImageBmpCtx(im, out, compression);
 	rv = gdDPExtractData(out, size);
 	out->gd_free(out);
 {
 	gdImagePtr im;
 	gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
+	if (in == NULL) return NULL;
 	im = gdImageCreateFromBmpCtx(in);
 	in->gd_free(in);
 	return im;
 {
   void *rv;
   gdIOCtx *out = gdNewDynamicCtx (2048, NULL);
+  if (out == NULL) return NULL;
   _gdImageGd (im, out);
   rv = gdDPExtractData (out, size);
   out->gd_free (out);
 {
   void *rv;
   gdIOCtx *out = gdNewDynamicCtx (2048, NULL);
+  if (out == NULL) return NULL;
   _gdImageGd2 (im, out, cs, fmt);
   rv = gdDPExtractData (out, size);
   out->gd_free (out);
 {
 	void *rv;
 	gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
+	if (out == NULL) return NULL;
 	gdImageGifCtx(im, out);
 	rv = gdDPExtractData(out, size);
 	out->gd_free(out);
 {
 	void *rv;
 	gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
+	if (out == NULL) return NULL;
 	gdImageGifAnimBeginCtx(im, out, GlobalCM, Loops);
 	rv = gdDPExtractData(out, size);
 	out->gd_free(out);
 {
 	void *rv;
 	gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
+	if (out == NULL) return NULL;
 	gdImageGifAnimAddCtx(im, out, LocalCM, LeftOfs, TopOfs, Delay, Disposal, previm);
 	rv = gdDPExtractData(out, size);
 	out->gd_free(out);
 {
 	void *rv;
 	gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
+	if (out == NULL) return NULL;
 	gdImageJpegCtx(im, out, quality);
 	rv = gdDPExtractData(out, size);
 	out->gd_free(out);
 {
 	void *rv;
 	gdIOCtx *out = gdNewDynamicCtx (2048, NULL);
+	if (out == NULL) return NULL;
 	gdImagePngCtxEx (im, out, -1);
 	rv = gdDPExtractData (out, size);
 	out->gd_free (out);
 {
 	void *rv;
 	gdIOCtx *out = gdNewDynamicCtx (2048, NULL);
+	if (out == NULL) return NULL;
 	gdImagePngCtxEx (im, out, level);
 	rv = gdDPExtractData (out, size);
 	out->gd_free (out);
 {
 	gdImagePtr im;
 	gdIOCtx *in = gdNewDynamicCtxEx (size, data, 0);
+	if (in == NULL) return NULL;
 	im = gdImageCreateFromTgaCtx(in);
 	in->gd_free(in);
 	return im;
 {
 	gdImagePtr im;
 	gdIOCtx *in = gdNewDynamicCtxEx (size, data, 0);
+	if (in == NULL) return NULL;
 	im = gdImageCreateFromTiffCtx(in);
 	in->gd_free(in);
 	return im;
 {
 	void *rv;
 	gdIOCtx *out = gdNewDynamicCtx (2048, NULL);
+	if (out == NULL) return NULL;
 	gdImageTiffCtx(im, out); /* what's an fg again? */
 	rv = gdDPExtractData(out, size);
 	out->gd_free(out);
 {
 	void *rv;
 	gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
+	if (out == NULL) return NULL;
 	gdImageWBMPCtx(im, fg, out);
 	rv = gdDPExtractData(out, size);
 	out->gd_free(out);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.