diff options
author | Marcus Glocker <mglocker@cvs.openbsd.org> | 2016-06-02 07:47:26 +0000 |
---|---|---|
committer | Marcus Glocker <mglocker@cvs.openbsd.org> | 2016-06-02 07:47:26 +0000 |
commit | 995667f1dc6844440ec3995417bae0be6ed2c2d8 (patch) | |
tree | f40ab7cee197eb5673f0067946a56a2333c87f02 | |
parent | ce0631563ed22a1cc82b7baf141b3cc7ee53d3c0 (diff) |
Just try to unmap a buffer when something has been mapped before.
ok semarie tb
-rw-r--r-- | app/video/video.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/app/video/video.c b/app/video/video.c index 1c1a90cc7..999f7fec5 100644 --- a/app/video/video.c +++ b/app/video/video.c @@ -1,4 +1,4 @@ -/* $OpenBSD: video.c,v 1.14 2016/05/31 08:45:14 tb Exp $ */ +/* $OpenBSD: video.c,v 1.15 2016/06/02 07:47:25 mglocker Exp $ */ /* * Copyright (c) 2010 Jacob Meuser <jakemsr@openbsd.org> * @@ -1313,10 +1313,12 @@ mmap_stop(struct video *vid) /* unmap the buffers */ for (i = 0; i < MMAP_NUM_BUFS; i++) { - r = munmap(vid->mmap_buffer[i], vid->bpf); - if (r == -1) { - warn("munmap"); - return 0; + if (vid->mmap_buffer[i] != NULL) { + r = munmap(vid->mmap_buffer[i], vid->bpf); + if (r == -1) { + warn("munmap"); + return 0; + } } } |