security: Fixing memory problem in SecPublicInfoSqlite::addCertificate
Change-Id: I313faf42be23bc4bd1e2d96cbf9f73db2f7e620d
diff --git a/src/security/sec-public-info-sqlite3.cpp b/src/security/sec-public-info-sqlite3.cpp
index b2bd512..774dfb3 100644
--- a/src/security/sec-public-info-sqlite3.cpp
+++ b/src/security/sec-public-info-sqlite3.cpp
@@ -94,10 +94,11 @@
* A utility function to call the normal sqlite3_bind_text where the value and length are
* value.c_str() and value.size().
*/
-static int sqlite3_bind_text(sqlite3_stmt* statement,
- int index,
- const string& value,
- void(*destructor)(void*))
+static int
+sqlite3_bind_text(sqlite3_stmt* statement,
+ int index,
+ const string& value,
+ void(*destructor)(void*))
{
return sqlite3_bind_text(statement, index, value.c_str(), value.size(), destructor);
}
@@ -482,7 +483,7 @@
// this will throw an exception if the signature is not the standard one
// or there is no key locator present
std::string signerName = certificate.getSignature().getKeyLocator().getName().toUri();
- sqlite3_bind_text(statement, 2, signerName, SQLITE_STATIC);
+ sqlite3_bind_text(statement, 2, signerName, SQLITE_TRANSIENT);
}
catch (Tlv::Error& e)
{