<div dir="auto"><div style="font-family:sans-serif;font-size:12.8px" dir="auto"><div style="margin:16px 0px"><div>Hi,</div><div dir="auto">Here are 2 questions, one about usage of memory after free, another seems to me like memory leak. Could you please either confirm that these are bugs and suggest fixes or help me work out why no?</div><div dir="auto"><br>Function src/loggin/Manager.cc: bool Manager::Write(EnumVal* id, RecordVal* columns) seems to be using memory that might have been freed already. CreateWriter function can delete info_and_fields and still return non null writer. Any suggestions how to fix it? Maybe do not delete info in CreateWriter if old writer still exists? Will info&#39;s memory be freed somewhere later?<br><br>I do not have a test case for this issue though.<br><br>// CreateWriter() will set the other fields in info.<br><br>            writer = CreateWriter(stream-&gt;id, filter-&gt;writer,<br>                          info, filter-&gt;num_fields, arg_fields, filter-&gt;local,<br>                          filter-&gt;remote, false, filter-&gt;name);<br><br>            if ( ! writer )<br>                {<br>                Unref(columns);<br>                return false;<br>                }<br>            }<br><br>        // Alright, can do the write now.<br><br>        threading::Value** vals = RecordToFilterVals(stream, filter, columns);<br><br>        if ( ! PLUGIN_HOOK_WITH_RESULT(HOOK_L<wbr>OG_WRITE,<br>HookLogWrite(filter-&gt;writer-&gt;T<wbr>ype()-&gt;AsEnumType()-&gt;Lookup(fi<wbr>lter-&gt;writer-&gt;InternalInt()),<br>filter-&gt;name, *info,<br>filter-&gt;num_fields,<br>filter-&gt;fields, vals), true) )<br><br><br><br>Another question is - inside src/input/Manager.cc -&gt; a lot of places where ev is allocated from EnumVal, it is not being freed or Unrefed.  Eg in function Manager::Delete(...reader, vals) , it seems like predidx and ev are allocated, but are not freed if there was not convert_error. This looks like memory is leaked in all those cases. </div><div dir="auto"><br> if ( stream-&gt;pred )<br>                              <wbr>  {<br>                              <wbr>  int startpos = 0;<br>                              <wbr>  Val* predidx = ValueToRecordVal(i, vals, stream-&gt;itype, &amp;startpos, convert_error);<br><br>                              <wbr>  if ( convert_error )<br>                              <wbr>          Unref(predidx);<br>                              <wbr>  else<br>                              <wbr>          {<br>                              <wbr>          Ref(val);<br>                              <wbr>          EnumVal *ev = new EnumVal(BifEnum::Input::EVENT_<wbr>REMOVED, BifType::Enum::Input::Event);<br><br>                              <wbr>          streamresult = CallPred(stream-&gt;pred, 3, ev, predidx, val);<br><br>                              <wbr>          if ( streamresult == false )<br>                              <wbr>                  {<br>                              <wbr>                  // keep it.<br>                              <wbr>                  Unref(idxval);<br>                              <wbr>                  success = true;<br>                              <wbr>                  }<br>                              <wbr>          }<br><br>                              <wbr>  }<br><br><br>Thank you for suggestions,<br><br>Martina<br><br></div></div><div style="height:0px"></div></div><br></div>