DecodeImageMem was leaking memory because the mat header wasn't being deallocated.

This commit is contained in:
Aditya Bhargava 2014-10-14 15:41:50 -07:00
parent 3c1981582d
commit 7ddf7bb787

View file

@ -10,6 +10,7 @@ import (
func DecodeImageMem(data []byte) *IplImage { func DecodeImageMem(data []byte) *IplImage {
buf := CreateMatHeader(1, len(data), CV_8U) buf := CreateMatHeader(1, len(data), CV_8U)
buf.SetData(unsafe.Pointer(&data[0]), CV_AUTOSTEP) buf.SetData(unsafe.Pointer(&data[0]), CV_AUTOSTEP)
defer buf.Release()
return DecodeImage(unsafe.Pointer(buf), CV_LOAD_IMAGE_UNCHANGED) return DecodeImage(unsafe.Pointer(buf), CV_LOAD_IMAGE_UNCHANGED)
} }