# HG changeset patch # User reimar # Date 1251807165 0 # Node ID 349de9bdfcce47a620c43af6f3d95d58c011b336 # Parent b128ce47771d7eb10f011c06a560d78876aec025 Make shm_fd a local variable and close it when we need it no longer, thus fixing a file descriptor leak. diff -r b128ce47771d -r 349de9bdfcce libvo/vo_corevideo.m --- a/libvo/vo_corevideo.m Tue Sep 01 10:48:47 2009 +0000 +++ b/libvo/vo_corevideo.m Tue Sep 01 12:12:45 2009 +0000 @@ -57,7 +57,6 @@ OSType pixelFormat; //shared memory -int shm_fd; BOOL shared_buffer = false; #define DEFAULT_BUFFER_NAME "mplayerosx" static char *buffer_name; @@ -173,6 +172,7 @@ } 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 @@ { 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) {