[Kimchi-devel] [kimchi-devel][PATCH 1/7] Fix md5 file handler leak
Aline Manera
alinefm at linux.vnet.ibm.com
Thu Jan 22 17:40:14 UTC 2015
Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>
On 20/01/2015 06:45, lvroyce at linux.vnet.ibm.com wrote:
> From: Royce Lv <lvroyce at linux.vnet.ibm.com>
>
> md5 file open without close, fix by closing it in with clause.
>
> Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
> ---
> src/kimchi/model/debugreports.py | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/kimchi/model/debugreports.py b/src/kimchi/model/debugreports.py
> index fbc0463..222270d 100644
> --- a/src/kimchi/model/debugreports.py
> +++ b/src/kimchi/model/debugreports.py
> @@ -112,8 +112,9 @@ class DebugReportsModel(object):
> # Deleting md5
> msg = 'Deleting report md5 file: "%s"' % (md5_report_file)
> kimchi_log.info(msg)
> - md5 = open(md5_report_file).read().strip()
> - kimchi_log.info('Md5 file content: "%s"', md5)
> + with open(md5_report_file) as f:
> + md5 = f.read().strip()
> + kimchi_log.info('Md5 file content: "%s"', md5)
> os.remove(md5_report_file)
> cb('OK', True)
> return
More information about the Kimchi-devel
mailing list