snmp_table_fetch_async: don't leak work if snmp_pdu_send(..) fails

MFC after:	1 week
Reported by:	Coverity
CID:		1017276
This commit is contained in:
Enji Cooper 2017-01-05 08:49:06 +00:00
parent 994c8618ec
commit 3daec7ae72
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=311390

View file

@ -728,8 +728,11 @@ snmp_table_fetch_async(const struct snmp_table *descr, void *list,
work->last_change = 0;
table_init_pdu(descr, &work->pdu);
if (snmp_pdu_send(&work->pdu, table_cb, work) == -1)
if (snmp_pdu_send(&work->pdu, table_cb, work) == -1) {
free(work);
work = NULL;
return (-1);
}
return (0);
}