summaryrefslogtreecommitdiff
path: root/yavta.c
diff options
context:
space:
mode:
Diffstat (limited to 'yavta.c')
-rw-r--r--yavta.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/yavta.c b/yavta.c
index 8e9ecc4..5328a1b 100644
--- a/yavta.c
+++ b/yavta.c
@@ -425,14 +425,25 @@ static int video_free_buffers(struct device *dev)
if (dev->nbufs == 0)
return 0;
- if (dev->memtype == V4L2_MEMORY_MMAP) {
- for (i = 0; i < dev->nbufs; ++i) {
+ for (i = 0; i < dev->nbufs; ++i) {
+ switch (dev->memtype) {
+ case V4L2_MEMORY_MMAP:
ret = munmap(dev->buffers[i].mem, dev->buffers[i].size);
if (ret < 0) {
printf("Unable to unmap buffer %u (%d)\n", i, errno);
return ret;
}
+ break;
+
+ case V4L2_MEMORY_USERPTR:
+ free(dev->buffers[i].mem);
+ break;
+
+ default:
+ break;
}
+
+ dev->buffers[i].mem = NULL;
}
memset(&rb, 0, sizeof rb);