components/net-snmp/patches/002.pkcs.patch
changeset 1278 5a3949922d70
parent 252 ee0fb1eabcbf
equal deleted inserted replaced
1277:0c751970523d 1278:5a3949922d70
     1 --- net-snmp-5.4.1/snmplib/pkcs.c	Tue Nov  6 02:00:04 2007
     1 Following patch is a fix for a bug in libnetsnmp which, under certain
     2 +++ net-snmp-5.4.1/snmplib/pkcs.mod.c	Tue Nov  6 01:58:30 2007
     2 circumstances, causes a core dump during snmp_shutdown.
       
     3 
       
     4 (Upstream Bug) #2374 net-snmp is coring when stopped
       
     5 =====================================================================
       
     6 --- net-snmp-5.4.1/snmplib/pkcs.c	Tue Mar  5 17:29:50 2013
       
     7 +++ net-snmp-5.4.1/snmplib/pkcs.mod.c	Tue Mar  5 17:35:30 2013
     3 @@ -1,5 +1,5 @@
     8 @@ -1,5 +1,5 @@
     4  /*
     9  /*
     5 - * Copyright Copyright 2003 Sun Microsystems, Inc. All rights reserved.
    10 - * Copyright Copyright 2003 Sun Microsystems, Inc. All rights reserved.
     6 + * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
    11 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
     7   * Use is subject to license terms specified in the COPYING file
    12   * Use is subject to license terms specified in the COPYING file
     8   * distributed with the Net-SNMP package.
    13   * distributed with the Net-SNMP package.
     9   */
    14   */
    10 @@ -107,10 +107,12 @@
    15 @@ -105,19 +105,13 @@
       
    16  static int
       
    17  free_slots(int majorID, int minorID, void *serverarg, void *clientarg)
    11  {
    18  {
    12      int            slotcount, i;
    19 -    int            slotcount, i;
       
    20 +    (void) C_Finalize(NULL);
    13  
    21  
    14 +    (void) C_Finalize(NULL);
       
    15 +
       
    16      if (pSlot != NULL) {
    22      if (pSlot != NULL) {
    17          slotcount = pSlot->count;
    23 -        slotcount = pSlot->count;
    18          for (i = 0; i < slotcount; i++) {
    24 -        for (i = 0; i < slotcount; i++) {
    19 -            if (pSlot->pSession->hdl != NULL) {
    25 -            if (pSlot->pSession->hdl != NULL) {
    20 +            if (pSlot->pSession != NULL) {
    26 -                free(pSlot->pSession->hdl);
    21                  free(pSlot->pSession->hdl);
    27 -            }
    22              }
    28 -        }
    23          }
    29 -        free(pSlot);
    24 @@ -117,7 +119,6 @@
    30 +        SNMP_FREE(pSlot->pSession);
    25          free(pSlot);
    31 +        SNMP_FREE(pSlot);
    26      }
    32      }
    27  
    33  
    28 -    (void) C_Finalize(NULL);
    34 -    (void) C_Finalize(NULL);
    29      return 0;
    35      return 0;
    30  }
    36  }