Hi Thang,

See my comments inline.

/Vu

On 6/2/20 11:11 AM, thang.d.nguyen wrote:
Fix definitely lost reported by valgrind.
---
  src/base/daemon.c         | 2 --
  src/log/logd/lgs_imm.cc   | 8 ++++++++
  src/log/logd/lgs_mbcsv.cc | 1 +
  3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/base/daemon.c b/src/base/daemon.c
index 48a0665f2..56f5aa8ff 100644
--- a/src/base/daemon.c
+++ b/src/base/daemon.c
@@ -57,7 +57,6 @@
#define DEFAULT_RUNAS_USERNAME "opensaf" -static const char *internal_version_id_; static char fifo_file[NAME_MAX];
  static char __pidfile[NAME_MAX];
@@ -294,7 +293,6 @@ void daemonize(int argc, char *argv[])
        char buf1[256 + sizeof("_SCHED_PRIORITY")] = {0};
        char buf2[256 + sizeof("_SCHED_POLICY")] = {0};
- internal_version_id_ = strdup("@(#) $Id: " INTERNAL_VERSION_ID " $");
[Vu] I think this line is intentional. Refer to this commit for more info.

commit 892322c6810e892e12c1042f076069c33745c6ca
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Tue Jan 7 14:57:46 2014 +0100

    osaf: Improve fault analyse by using current changeset when configuring osaf [#676]

    Current changeset is visible in the syslog, in corefiles using ident, and also     in the amfd and amfnd binaries (use ident). Updated wih review comments.

if (argc > 0 && argv != NULL) {
                __parse_options(argc, argv);
diff --git a/src/log/logd/lgs_imm.cc b/src/log/logd/lgs_imm.cc
index 9094be5f3..1889a57b3 100644
--- a/src/log/logd/lgs_imm.cc
+++ b/src/log/logd/lgs_imm.cc
@@ -3027,6 +3027,14 @@ SaAisErrorT lgs_imm_init_configStreams(lgs_cb_t *cb) {
    }
done:
+  /* Free memory allocated for attribute descriptions */
+  om_rc = saImmOmClassDescriptionMemoryFree_2(omHandle, attr_definitions);
+  if (om_rc != SA_AIS_OK) {
+    LOG_NO("saImmOmClassDescriptionMemoryFree_2() Fail %s",
+      saf_error(om_rc));
+    goto done;
+  }
[Vu] I think the memory is freed when the search handle or om handle is finalized in below lines.
I is probably mentioned in SAF spec. You can  refer to it for more info.

/Vu
+
    /* Do not abort if error when finalizing */
    om_rc = immutil_saImmOmSearchFinalize(immSearchHandle);
    if (om_rc != SA_AIS_OK) {
diff --git a/src/log/logd/lgs_mbcsv.cc b/src/log/logd/lgs_mbcsv.cc
index 6ec004f0a..ad98b1036 100644
--- a/src/log/logd/lgs_mbcsv.cc
+++ b/src/log/logd/lgs_mbcsv.cc
@@ -341,6 +341,7 @@ uint32_t edp_ed_open_stream_rec(EDU_HDL *edu_hdl, EDU_TKN 
*edu_tkn,
      } else {
        ckpt_open_stream_msg_ptr = static_cast<lgs_ckpt_stream_open_t *>(ptr);
      }
+    osafassert(ckpt_open_stream_msg_ptr != NULL);
rc = m_NCS_EDU_RUN_RULES(edu_hdl, edu_tkn, ckpt_open_stream_rec_ed_rules,
                               ckpt_open_stream_msg_ptr, ptr_data_len, buf_env,



_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to