We might as well mess with avoid freeing the req pointer
only when failures occur, otherwise perform as before
{
ERROR("snmp plugin: Can't allocate memory");
strarray_free(dd->ignores, dd->ignores_len);
- return (ENOMEM);
+ return (ENOMEM);
}
}
return 0;
snmp_free_pdu (res);
res = NULL;
+ /* snmp_synch_response already freed our PDU */
+ req = NULL;
sfree (errstr);
csnmp_host_close_session (host);
snmp_free_pdu (res);
res = NULL;
- /*
- * memory is handled by snmp_synch_response
- */
+ if (req != NULL)
+ snmp_free_pdu (req);
req = NULL;
if (status == 0)