close file handler leak 3.5
authorAurelien Campeas
Wed, 09 Sep 2009 17:58:09 +0200
branch3.5
changeset 3152 7ef7c82daf59
parent 3151 5d45c0945bd3
child 3153 93ce84956679
close file handler leak
common/migration.py
--- a/common/migration.py	Wed Sep 09 17:57:46 2009 +0200
+++ b/common/migration.py	Wed Sep 09 17:58:09 2009 +0200
@@ -338,7 +338,7 @@
         configfile = self.config.main_config_file()
         if self._option_changes:
             read_old_config(self.config, self._option_changes, configfile)
-        _, newconfig = tempfile.mkstemp()
+        fd, newconfig = tempfile.mkstemp()
         for optdescr in self._option_changes:
             if optdescr[0] == 'added':
                 optdict = self.config.get_option_def(optdescr[1])
@@ -346,6 +346,7 @@
                     self.config.input_option(optdescr[1], optdict)
         self.config.generate_config(open(newconfig, 'w'))
         show_diffs(configfile, newconfig)
+        os.close(fd)
         if exists(newconfig):
             os.unlink(newconfig)