From 9bbce4d54c1d54b660ec04b18d507f20a2a31ccf Mon Sep 17 00:00:00 2001
From: Erwan Velu <erwan@redhat.com>
Date: Mon, 26 Sep 2016 22:18:12 +0200
Subject: [PATCH 15/43] osutils: Using delete[] instead of delete
When compiling lshw, we get a warning regarding the usage of delete.
osutils.cc:425:3: warning: Memory allocated by 'new[]' should be deallocated by 'delete[]', not 'delete'
This commit simply use the proper delete operator for this operation.
---
src/core/osutils.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/osutils.cc b/src/core/osutils.cc
index 95c8483..cc03dc4 100644
--- a/src/core/osutils.cc
+++ b/src/core/osutils.cc
@@ -422,7 +422,7 @@ string dirname(const string & path)
path.copy(buffer, len);
buffer[len] = '\0';
string result = dirname(buffer);
- delete buffer;
+ delete[] buffer;
return result;
}
--
2.10.2