diff --git a/selfdrive/common/visionbuf_ion.c b/selfdrive/common/visionbuf_ion.c index 9b30483b12..5c26bea6ad 100644 --- a/selfdrive/common/visionbuf_ion.c +++ b/selfdrive/common/visionbuf_ion.c @@ -131,7 +131,9 @@ void visionbuf_sync(const VisionBuf* buf, int dir) { } void visionbuf_free(const VisionBuf* buf) { - CL_CHECK(clReleaseMemObject(buf->buf_cl)); + if (buf->buf_cl) { + CL_CHECK(clReleaseMemObject(buf->buf_cl)); + } munmap(buf->addr, buf->mmap_len); close(buf->fd); struct ion_handle_data handle_data = {