I am writing an application that gets some object from UPS's. One is the status 
which
I am using get_tree to pull out the formated string. It works but the 
application seems
to be using more memory as time goes on. I do not use memory allocation function
in my code. I am closing the the other objects using snmp_free_pdu and 
snmp_close
and SOCK_CLEANUP, so I am thinking it is the get_tree. 

Is the a function to deallocate the object(s) created ?

code snippet below
-----

                        if( ups_sensor_table[table_index].sensor_type == 2 )
                        {
                                /* get the mib entry for this object */
                                tp = get_tree( anOID, anOID_len, 
get_tree_head());
                                object_type = tp->type;
                                if(tp->enums)
                                {
                                        struct enum_list *ep = tp->enums;
                                        while( integer_oid_value != ep->value )
                                        {
                                                ep = ep->next;
                                        }
                                        snprintf( object_name, MAX_OID_LEN, 
"%s", ep->label);
                                }
                                else
                                {
                                        object_name[0] = '\0';
                                }
#ifdef DEBUG
        printf("ups polling DEBUG: host is %s, object_type is %d, object_name 
is %s \n", ups_sensor_table[table_index].host
_name, object_type, object_name );
#endif
     
                                if( object_type == 3 )
                                {
                                        strcpy( 
ups_location_table[site_index].status, object_name );
                                }
                        }

---

ron.swier...@sdf.org
SDF Public Access UNIX System - http://sdf.org

------------------------------------------------------------------------------
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to