Release imgRef

release imgRef to solve memory leak.