Skip to content

Commit

Permalink
fixed a few memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
bowang committed Jan 18, 2012
1 parent 7010c20 commit 55f2fa1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/transform.cc
Expand Up @@ -395,6 +395,7 @@ int PNGPixel(unsigned char red, unsigned char green, unsigned char blue,
VipsImage* tmp = vips_image_new_from_memory(buf, 1, 1, 4, VIPS_FORMAT_UCHAR);
if (tmp == NULL) {
err_msg->assign("can't create a vips image");
vips_free(buf);
return -1;
}
PEL RGBA[4];
Expand All @@ -405,13 +406,15 @@ int PNGPixel(unsigned char red, unsigned char green, unsigned char blue,
int result = im_draw_flood(tmp, 0, 0, RGBA, NULL);
if (result != 0) {
err_msg->assign("draw_rect failed.");
vips_free(buf);
return -1;
}
tmp->Xres = 2.835017718860743;
tmp->Yres = 2.835017718860743;
result = im_vips2bufpng(tmp, NULL, 6, 0, pixelData, pixelLen);
if (result != 0) {
err_msg->assign("cannot write as png");
vips_free(buf);
return -1;
}
vips_free(buf);
Expand Down

0 comments on commit 55f2fa1

Please sign in to comment.