From patchwork Thu Nov 1 22:35:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/1] python magic: Fix memory leak caused by not closing loaded file magic Date: Thu, 01 Nov 2012 12:35:09 -0000 From: Morten Svendsen X-Patchwork-Id: 196399 Message-Id: <4287a6e6d3205909386770a4aa1f6a3438ec017a.1351808899.git.morten.thunbergsvendsen@prevas.dk> To: --- classes/core.oeclass | 1 + classes/image-qa.oeclass | 1 + 2 files changed, 2 insertions(+) diff --git a/classes/core.oeclass b/classes/core.oeclass index 394d69b..cb90a6d 100644 --- a/classes/core.oeclass +++ b/classes/core.oeclass @@ -144,6 +144,7 @@ def runstrip(file, d): filemagic = magic.open(magic.MAGIC_NONE) filemagic.load() filetype = filemagic.file(file) + filemagic.close() if not filetype: bb.error("runstrip() unable to determine file type: %s"%(file)) diff --git a/classes/image-qa.oeclass b/classes/image-qa.oeclass index f5ac5ea..35dbebc 100644 --- a/classes/image-qa.oeclass +++ b/classes/image-qa.oeclass @@ -107,4 +107,5 @@ python do_imageqa () { if readelf_check("HOST") or readelf_check("TARGET"): bb.fatal("libraries missing") + filemagic.close() }