← Back to team overview

kicad-developers team mailing list archive

[PATCH] Fix leaks in DL_Dxf::test

 

Hi,

There is a resource leak in DL_Dxf::test().

This function is never actually used and only provides some kind of
manual test case. However, the leaks set off static analysers like
Coverity (6 times), so we might as well fix it since it's easy?

Cheers,

John
From 2e4bdc2e93cc577b6d37592e077b897f71ba6d6f Mon Sep 17 00:00:00 2001
From: John Beard <john.j.beard@xxxxxxxxx>
Date: Fri, 28 Sep 2018 18:21:20 +0100
Subject: [PATCH] Dxf: Fix leaks in DL_Dxf::test

This function is never actually used, but the resource leaks
set off static analysers.

Fixes: coverity:131460-131465
---
 dxflib_qcad/dl_dxf.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/dxflib_qcad/dl_dxf.cpp b/dxflib_qcad/dl_dxf.cpp
index d99286189..4f43db9a2 100644
--- a/dxflib_qcad/dl_dxf.cpp
+++ b/dxflib_qcad/dl_dxf.cpp
@@ -6392,4 +6392,11 @@ void DL_Dxf::test()
     std::cout << "1 buf6: '" << buf6 << "'\n";
     stripWhiteSpace( &buf6 );
     std::cout << "2 buf6: '" << buf6 << "'\n";
+
+    delete( buf1 );
+    delete( buf2 );
+    delete( buf3 );
+    delete( buf4 );
+    delete( buf5 );
+    delete( buf6 );
 }
-- 
2.19.0


Follow ups