Don't call snmp_pdu_free(..) until finished with the pdu and when ready to

allocate a new one via snmp_pdu_create(..)

This fixes bsnmpwalk, so it no longer crashes after r310729

X-MFC with:	r310729
MFC after:	12 days
This commit is contained in:
Enji Cooper 2016-12-31 09:43:35 +00:00
parent 7c87f23e82
commit bcf5255764
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=310892

View File

@ -498,7 +498,6 @@ snmptool_walk(struct snmp_toolinfo *snmptoolctx)
}
outputs += rc;
snmp_pdu_free(&resp);
if ((u_int)rc < resp.nbindings)
break;
@ -518,8 +517,6 @@ snmptool_walk(struct snmp_toolinfo *snmptoolctx)
snmp_output_err_resp(snmptoolctx, &resp);
else
snmp_output_resp(snmptoolctx, &(resp), NULL);
snmp_pdu_free(&resp);
} else
warn("Snmp dialog");
}
@ -529,6 +526,8 @@ snmptool_walk(struct snmp_toolinfo *snmptoolctx)
break;
}
snmp_pdu_free(&resp);
snmp_pdu_create(&req, op);
}