mirror of
https://github.com/go-vgo/robotgo
synced 2026-05-24 10:19:01 +00:00
fixed findBitmap and findPic memory leak
This commit is contained in:
parent
126392f38b
commit
ff8cd7b142
1 changed files with 7 additions and 1 deletions
|
|
@ -858,7 +858,11 @@ func FindBitmap(bit C.MMBitmapRef, args ...interface{}) (int, int) {
|
|||
tolerance = 0.5
|
||||
}
|
||||
|
||||
return internalFindBitmap(bit, sbit, tolerance)
|
||||
fx, fy := internalFindBitmap(bit, sbit, tolerance)
|
||||
FreeBitmap(bit)
|
||||
FreeBitmap(sbit)
|
||||
|
||||
return fx, fy
|
||||
}
|
||||
|
||||
// FindPic finding the image by path
|
||||
|
|
@ -886,6 +890,8 @@ func FindPic(path string, args ...interface{}) (int, int) {
|
|||
}
|
||||
|
||||
fx, fy := internalFindBitmap(openbit, sbit, tolerance)
|
||||
FreeBitmap(openbit)
|
||||
FreeBitmap(sbit)
|
||||
|
||||
return fx, fy
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue