summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonrad Lipinski <k.lipinski2@partner.samsung.com>2019-05-06 20:24:55 +0200
committerKonrad Lipinski <k.lipinski2@partner.samsung.com>2019-05-08 17:53:34 +0200
commita9844c2ed624b961164fa1e04ee9691c1c43d895 (patch)
tree171c802a715c5ef30ef01a6627e4b2b94ac2e474
parent7bc501bef926142ed84d330749608e05ab55facb (diff)
downloadkey-manager-a9844c2ed624b961164fa1e04ee9691c1c43d895.tar.gz
key-manager-a9844c2ed624b961164fa1e04ee9691c1c43d895.tar.bz2
key-manager-a9844c2ed624b961164fa1e04ee9691c1c43d895.zip
Fix svace defects
va_start / va_end must be called in the same function Change-Id: I5176fc2686a62eb0a21e6eb9a5f737dbc3880056
-rw-r--r--src/manager/dpl/db/src/sql_connection.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/manager/dpl/db/src/sql_connection.cpp b/src/manager/dpl/db/src/sql_connection.cpp
index cb4ee0b..902c94d 100644
--- a/src/manager/dpl/db/src/sql_connection.cpp
+++ b/src/manager/dpl/db/src/sql_connection.cpp
@@ -36,16 +36,6 @@
namespace {
const int MAX_RETRY = 10;
-
-struct ScopedVaList {
- ~ScopedVaList()
- {
- va_end(args);
- }
- va_list args;
-};
-
-#define scoped_va_start(name, param) ScopedVaList name; va_start(name.args, param);
}
namespace CKM {
@@ -952,17 +942,29 @@ void SqlConnection::ExecCommandHelper(Output *out, const char *format,
//LCOV_EXCL_START
void SqlConnection::ExecCommand(Output *out, const char *format, ...)
{
- scoped_va_start(svl, format);
-
- ExecCommandHelper(out, format, svl.args);
+ va_list args;
+ va_start(args, format);
+ try {
+ ExecCommandHelper(out, format, args);
+ } catch (...) {
+ va_end(args);
+ throw;
+ }
+ va_end(args);
}
//LCOV_EXCL_STOP
void SqlConnection::ExecCommand(const char *format, ...)
{
- scoped_va_start(svl, format);
-
- ExecCommandHelper(NULL, format, svl.args);
+ va_list args;
+ va_start(args, format);
+ try {
+ ExecCommandHelper(NULL, format, args);
+ } catch (...) {
+ va_end(args);
+ throw;
+ }
+ va_end(args);
}
SqlConnection::DataCommandUniquePtr SqlConnection::PrepareDataCommand(