Update xmlsec callback logging 63/285563/1
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Wed, 14 Dec 2022 16:26:55 +0000 (17:26 +0100)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Wed, 14 Dec 2022 16:26:55 +0000 (17:26 +0100)
The main purpose of this commit is to help with debugging memory leaks in a
client app.
* Log file closing callback to make sure that files are closed eventually.
* Log only filename without the prefix in file opening callback. The prefix is
  logged elsewhere anyway. This is to avoid log truncating on some images.

Change-Id: I20bd376c18b9c2f0ab865cf9dccdaf8cedbec202

src/vcore/XmlsecAdapter.cpp

index 92e8dc5..477a229 100644 (file)
@@ -75,8 +75,9 @@ int XmlSec::fileMatchCallback(const char *filename)
 
 void *XmlSec::fileOpenCallback(const char *filename)
 {
+       LogDebug("Xmlsec opening:" << filename);
+
        std::string path = s_prefixPath + filename;
-       LogDebug("Xmlsec opening : " << path);
        return new FileWrapper(xmlFileOpen(path.c_str()), false);
 }
 
@@ -101,6 +102,8 @@ int XmlSec::fileReadCallback(void *context,
 
 int XmlSec::fileCloseCallback(void *context)
 {
+       LogDebug("Xmlsec closing");
+
        FileWrapper *fw = static_cast<FileWrapper *>(context);
        int output = 0;
 
@@ -224,7 +227,7 @@ XmlSec::~XmlSec()
 void XmlSec::validateFile(XmlSecContext &context, xmlSecKeysMngrPtr mngrPtr)
 {
        fileExtractPrefix(context);
-       LogDebug("Prefix path : " << s_prefixPath);
+       LogDebug("Prefix:" << s_prefixPath);
        xmlSecIOCleanupCallbacks();
        if (xmlSecIORegisterCallbacks(
                fileMatchCallback,