[MPlayer-cvslog] r28390 - trunk/input/lirc.c

reimar subversion at mplayerhq.hu
Fri Jan 30 16:41:45 CET 2009


Author: reimar
Date: Fri Jan 30 16:41:45 2009
New Revision: 28390

Log:
Move setting of O_NONBLOCK before lirc_readconfig, this avoids a memleak
due to not freeing the lirc config on error.

Modified:
   trunk/input/lirc.c

Modified: trunk/input/lirc.c
==============================================================================
--- trunk/input/lirc.c	Fri Jan 30 16:38:54 2009	(r28389)
+++ trunk/input/lirc.c	Fri Jan 30 16:41:45 2009	(r28390)
@@ -46,13 +46,6 @@ mp_input_lirc_init(void) {
     return -1;
   }
 
-  if(lirc_readconfig( lirc_configfile,&lirc_config,NULL )!=0 ){
-    mp_msg(MSGT_LIRC,MSGL_ERR,MSGTR_LIRCcfgerr,
-		    lirc_configfile == NULL ? "~/.lircrc" : lirc_configfile);
-    lirc_deinit();
-    return -1;
-  }
-
   mode = fcntl(lirc_sock, F_GETFL);
   if (mode < 0 || fcntl(lirc_sock, F_SETFL, mode | O_NONBLOCK) < 0) {
     mp_msg(MSGT_LIRC, MSGL_ERR, "setting non-blocking mode failed: %s\n",
@@ -61,6 +54,13 @@ mp_input_lirc_init(void) {
     return -1;
   }
 
+  if(lirc_readconfig( lirc_configfile,&lirc_config,NULL )!=0 ){
+    mp_msg(MSGT_LIRC,MSGL_ERR,MSGTR_LIRCcfgerr,
+		    lirc_configfile == NULL ? "~/.lircrc" : lirc_configfile);
+    lirc_deinit();
+    return -1;
+  }
+
   return lirc_sock;
 }
 



More information about the MPlayer-cvslog mailing list