mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-01-18 11:12:10 +02:00
Try to free resulting image data on error
This commit is contained in:
parent
0b5c85f644
commit
20d6c2778a
@ -674,6 +674,7 @@ func vipsSaveImage(img *C.struct__VipsImage, imgtype imageType, quality int) ([]
|
||||
err = C.vips_jpegsave_go(img, &ptr, &imgsize, 1, C.int(quality), cConf.JpegProgressive)
|
||||
case imageTypePNG:
|
||||
if err = C.vips_pngsave_go(img, &ptr, &imgsize, cConf.PngInterlaced, 1); err != 0 {
|
||||
C.g_free_go(&ptr)
|
||||
logWarning("Failed to save PNG; Trying not to embed icc profile")
|
||||
err = C.vips_pngsave_go(img, &ptr, &imgsize, cConf.PngInterlaced, 0)
|
||||
}
|
||||
@ -685,6 +686,7 @@ func vipsSaveImage(img *C.struct__VipsImage, imgtype imageType, quality int) ([]
|
||||
err = C.vips_icosave_go(img, &ptr, &imgsize)
|
||||
}
|
||||
if err != 0 {
|
||||
C.g_free_go(&ptr)
|
||||
return nil, cancel, vipsError()
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user