comparison nnchat.c @ 315:864e6e52ed69

Fix a filehandle leak when reading in configuration file.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 11 Jun 2011 06:01:58 +0300
parents 77f2093f9310
children 1065115665bd
comparison
equal deleted inserted replaced
314:77f2093f9310 315:864e6e52ed69
1307 FILE *cfgfile; 1307 FILE *cfgfile;
1308 setConfigFile = th_strdup_printf("%s" SET_DIR_SEPARATOR "%s", homeDir, SET_CONFIG_FILE); 1308 setConfigFile = th_strdup_printf("%s" SET_DIR_SEPARATOR "%s", homeDir, SET_CONFIG_FILE);
1309 1309
1310 THMSG(0, "Reading configuration from '%s'.\n", setConfigFile); 1310 THMSG(0, "Reading configuration from '%s'.\n", setConfigFile);
1311 1311
1312 if ((cfgfile = fopen(setConfigFile, "r")) != NULL) 1312 if ((cfgfile = fopen(setConfigFile, "r")) != NULL) {
1313 th_cfg_read(cfgfile, setConfigFile, cfg); 1313 th_cfg_read(cfgfile, setConfigFile, cfg);
1314 fclose(cfgfile);
1315 }
1314 } 1316 }
1315 1317
1316 setBrowser = getenv("BROWSER"); 1318 setBrowser = getenv("BROWSER");
1317 if (setBrowser == NULL) 1319 if (setBrowser == NULL)
1318 setBrowser = "firefox"; 1320 setBrowser = "firefox";