Author: ngie
Date: Fri Jan 13 09:01:09 2017
New Revision: 312052
URL: https://svnweb.freebsd.org/changeset/base/312052

Log:
  MFC r311390:
  
  snmp_table_fetch_async: don't leak `work` if snmp_pdu_send(..) fails
  
  CID:          1017276

Modified:
  stable/10/contrib/bsnmp/lib/snmpclient.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/contrib/bsnmp/lib/snmpclient.c
==============================================================================
--- stable/10/contrib/bsnmp/lib/snmpclient.c    Fri Jan 13 09:01:06 2017        
(r312051)
+++ stable/10/contrib/bsnmp/lib/snmpclient.c    Fri Jan 13 09:01:09 2017        
(r312052)
@@ -728,8 +728,11 @@ snmp_table_fetch_async(const struct snmp
        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);
 }
 
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to