diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-09-01 12:12:45 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-09-01 12:12:45 +0000 |
commit | 7b7302b096beb179da65cd5915707fa27ac36bd0 (patch) | |
tree | 0b58e7e9d7ddb15feafbcc2ccfac99db67bf76a1 | |
parent | 0f7fe327258bf6c059080210e0c7a106e866cec4 (diff) | |
download | mpv-7b7302b096beb179da65cd5915707fa27ac36bd0.tar.bz2 mpv-7b7302b096beb179da65cd5915707fa27ac36bd0.tar.xz |
Make shm_fd a local variable and close it when we need it no longer, thus
fixing a file descriptor leak.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29609 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libvo/vo_corevideo.m | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libvo/vo_corevideo.m b/libvo/vo_corevideo.m index 73f29727e7..2e43679e98 100644 --- a/libvo/vo_corevideo.m +++ b/libvo/vo_corevideo.m @@ -57,7 +57,6 @@ NSAutoreleasePool *autoreleasepool; OSType pixelFormat; //shared memory -int shm_fd; BOOL shared_buffer = false; #define DEFAULT_BUFFER_NAME "mplayerosx" static char *buffer_name; @@ -173,6 +172,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_ } else { + int shm_fd; mp_msg(MSGT_VO, MSGL_INFO, "[vo_corevideo] writing output to a shared buffer " "named \"%s\"\n",buffer_name); @@ -190,12 +190,14 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_ { mp_msg(MSGT_VO, MSGL_FATAL, "[vo_corevideo] failed to size shared memory, possibly already in use. Error: %s\n", strerror(errno)); + close(shm_fd); shm_unlink(buffer_name); return 1; } image_data = mmap(NULL, image_width*image_height*image_bytes, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0); + close(shm_fd); if (image_data == MAP_FAILED) { |