unref the image *after* we used it

Otherwise we manipulate potentially deallocated memory.
On some distributions things go fine for some reason, but
on others the memory actually gets deallocated and garbage is used,
leading to a segmentation fault in vips_image_guess_interpretation

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
master
Marc-Antoine Perennou 5 years ago
parent 0fcfb9757f
commit 58fb35672e

@ -388,8 +388,9 @@ func vipsInterpretationBuffer(buf []byte) (Interpretation, error) {
if err != nil {
return InterpretationError, err
}
interp := vipsInterpretation(image)
C.g_object_unref(C.gpointer(image))
return vipsInterpretation(image), nil
return interp, nil
}
func vipsInterpretation(image *C.VipsImage) Interpretation {

Loading…
Cancel
Save