From 2ccc66582b166e60b930bd44ab223baadcf9ccef Mon Sep 17 00:00:00 2001 From: foobar Date: Sat, 8 Jan 2005 12:02:39 +0000 Subject: [PATCH] MFH: - Fix some memory leaks --- ext/snmp/php_snmp.h | 1 + ext/snmp/snmp.c | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ext/snmp/php_snmp.h b/ext/snmp/php_snmp.h index e923ca11a3..6a33b7ba19 100644 --- a/ext/snmp/php_snmp.h +++ b/ext/snmp/php_snmp.h @@ -39,6 +39,7 @@ extern zend_module_entry snmp_module_entry; #endif PHP_MINIT_FUNCTION(snmp); +PHP_MSHUTDOWN_FUNCTION(snmp); PHP_MINFO_FUNCTION(snmp); PHP_FUNCTION(snmpget); diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index 475795665e..fcaf491e1d 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -153,7 +153,7 @@ zend_module_entry snmp_module_entry = { "snmp", snmp_functions, PHP_MINIT(snmp), - NULL, + PHP_MSHUTDOWN(snmp), NULL, NULL, PHP_MINFO(snmp), @@ -180,7 +180,7 @@ static void php_snmp_init_globals(zend_snmp_globals *snmp_globals) */ PHP_MINIT_FUNCTION(snmp) { - init_snmp("snmpapp"); + init_snmp("php"); ZEND_INIT_MODULE_GLOBALS(snmp, php_snmp_init_globals, NULL); @@ -205,6 +205,16 @@ PHP_MINIT_FUNCTION(snmp) } /* }}} */ +/* {{{ PHP_MSHUTDOWN_FUNCTION + */ +PHP_MSHUTDOWN_FUNCTION(snmp) +{ + snmp_shutdown("php"); + + return SUCCESS; +} +/* }}} */ + /* {{{ PHP_MINFO_FUNCTION */ PHP_MINFO_FUNCTION(snmp) @@ -834,7 +844,7 @@ static int netsnmp_session_gen_auth_key(struct snmp_session *s, char *pass TSRML s->securityAuthKeyLen = USM_AUTH_KU_LEN; if (s->securityAuthProto == NULL) { /* get .conf set default */ - oid *def = get_default_authtype(&(s->securityAuthProtoLen)); + const oid *def = get_default_authtype(&(s->securityAuthProtoLen)); s->securityAuthProto = snmp_duplicate_objid(def, s->securityAuthProtoLen); } if (s->securityAuthProto == NULL) { @@ -863,7 +873,7 @@ static int netsnmp_session_gen_sec_key(struct snmp_session *s, u_char *pass TSRM s->securityPrivKeyLen = USM_PRIV_KU_LEN; if (s->securityPrivProto == NULL) { /* get .conf set default */ - oid *def = get_default_privtype(&(s->securityPrivProtoLen)); + const oid *def = get_default_privtype(&(s->securityPrivProtoLen)); s->securityPrivProto = snmp_duplicate_objid(def, s->securityPrivProtoLen); } if (s->securityPrivProto == NULL) { -- 2.50.1