View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0007063 | ardour | bugs | public | 2016-10-07 16:39 | 2016-10-07 17:52 |
| Reporter | nstewart | Assigned To | x42 | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Platform | all | OS | all | ||
| Product Version | 5.X git (version in description) | ||||
| Summary | 0007063: SysEx class can leak _flag member | ||||
| Description | cppcheck indicates that the SysEx class can leak the _flag member, and lacks a copy constructor. It doesn't appear to ever be copied (I made a private copy constructor and was able to compile.) I also added a destructor to free allocated memory and suppress the warning. | ||||
| Additional Information | [gtk2_ardour/sys_ex.h:48]: (style) Unused private function: SysEx::event_handler' [gtk2_ardour/sys_ex.h:29]: (style) 'class SysEx' does not have a copy constructor which is recommended since the class contains a pointer to allocated memory. [gtk2_ardour/sys_ex.h:50]: (style) Class 'SysEx' is unsafe, 'SysEx::_flag' can leak by wrong usage. ====================== From 6bf7fee813e9d1f159c33c9049451f78ddc475a4 Mon Sep 17 00:00:00 2001 From: Nathan Stewart <therealnathanstewart@gmail.com> Date: Fri, 7 Oct 2016 12:38:00 -0400 Subject: [PATCH] Clean up cppcheck warnings about handling of allocated memory in SysEx class --- gtk2_ardour/sys_ex.cc | 2 ++ gtk2_ardour/sys_ex.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/sys_ex.cc b/gtk2_ardour/sys_ex.cc index b625193..f3e02b1 100644 --- a/gtk2_ardour/sys_ex.cc +++ b/gtk2_ardour/sys_ex.cc @@ -45,6 +45,8 @@ SysEx::SysEx ( SysEx::~SysEx() { + delete _flag; + _flag = 0; } bool diff --git a/gtk2_ardour/sys_ex.h b/gtk2_ardour/sys_ex.h index 709841c..1290482 100644 --- a/gtk2_ardour/sys_ex.h +++ b/gtk2_ardour/sys_ex.h @@ -46,7 +46,7 @@ public: private: bool event_handler (GdkEvent* ev); - + SysEx(const SysEx& rhs){} ArdourCanvas::Flag* _flag; }; -- 2.7.4 | ||||
| Tags | No tags attached. | ||||
|
|
0001-Clean-up-cppcheck-warnings-about-handling-of-allocat.patch (904 bytes)
From 6bf7fee813e9d1f159c33c9049451f78ddc475a4 Mon Sep 17 00:00:00 2001
From: Nathan Stewart <therealnathanstewart@gmail.com>
Date: Fri, 7 Oct 2016 12:38:00 -0400
Subject: [PATCH] Clean up cppcheck warnings about handling of allocated memory
in SysEx class
---
gtk2_ardour/sys_ex.cc | 2 ++
gtk2_ardour/sys_ex.h | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/gtk2_ardour/sys_ex.cc b/gtk2_ardour/sys_ex.cc
index b625193..f3e02b1 100644
--- a/gtk2_ardour/sys_ex.cc
+++ b/gtk2_ardour/sys_ex.cc
@@ -45,6 +45,8 @@ SysEx::SysEx (
SysEx::~SysEx()
{
+ delete _flag;
+ _flag = 0;
}
bool
diff --git a/gtk2_ardour/sys_ex.h b/gtk2_ardour/sys_ex.h
index 709841c..1290482 100644
--- a/gtk2_ardour/sys_ex.h
+++ b/gtk2_ardour/sys_ex.h
@@ -46,7 +46,7 @@ public:
private:
bool event_handler (GdkEvent* ev);
-
+ SysEx(const SysEx& rhs){}
ArdourCanvas::Flag* _flag;
};
--
2.7.4
|
|
|
applied as Ardour 5.4-63-g59cc0a1 Thanks |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2016-10-07 16:39 | nstewart | New Issue | |
| 2016-10-07 17:46 | nstewart | File Added: 0001-Clean-up-cppcheck-warnings-about-handling-of-allocat.patch | |
| 2016-10-07 17:52 | x42 | Note Added: 0018779 | |
| 2016-10-07 17:52 | x42 | Status | new => closed |
| 2016-10-07 17:52 | x42 | Assigned To | => x42 |
| 2016-10-07 17:52 | x42 | Resolution | open => fixed |