Is there a bug?

Frank Fock Frank.Fock____t-online.de
Fri Aug 25 17:19:25 CEST 2000


Hi Xu,

thanks for reporting this bug. I fixed it already for the next update,
which will be available on Monday. This method has not been used
within AGENT++ so far. It is funny that we found the bug
simultaneously ;-)

When using this method, please make sure you call the clear() method
of the returned list, before you delete it, because otherwise its
destructor
will delete the items of the tables content.

Best regards,
Frank

xuzhen wrote:

> hi,
> I used the method get_rows() of MibTable, but found it won't work. So I
> read the code of agent++ and found the code below in mib.cpp.
>
> List<MibTableRow> MibTable::get_rows(boolean discriminator)
> {
>  OidListCursor<MibTableRow> cur;
>  List<MibTableRow> list;
>  for (cur.init(&content); cur.get(); cur.next()) {
>   snmpRowStatus* status = cur.get()->get_row_status();
>   if ((!status) || (discriminator == 0) ||
>       ((status) && (status->get() == discriminator))) {
>    list.add(cur.get());
>   }
>  }
>  return list;
> }
>
> I modified it to below , everything was OK.
>
> List<MibTableRow>* MibTable::get_rows(boolean discriminator)
> {
>  OidListCursor<MibTableRow> cur;
>  List<MibTableRow>* list = new List<MibTableRow>();
>  for (cur.init(&content); cur.get(); cur.next()) {
>   snmpRowStatus* status = cur.get()->get_row_status();
>   if ((!status) || (discriminator == 0) ||
>       ((status) && (status->get() == discriminator))) {
>    list->add(cur.get());
>   }
>  }
>  return list;
> }
>
> Have any one used the first piece of code without "segment fault"?
> Best regards
> Xu




More information about the AGENTPP mailing list