diff options
author | Stig Bakken <ssb@php.net> | 2001-10-15 18:36:43 +0000 |
---|---|---|
committer | Stig Bakken <ssb@php.net> | 2001-10-15 18:36:43 +0000 |
commit | 013040516885ddf73a703e21b7d505037f0f3ea9 (patch) | |
tree | e504a2008b3410e2abe70468a3a1cfc1a86e5e8b | |
parent | dbe9e0bfc2ad42ff7a5e7eee6cd8cd39df00eff1 (diff) | |
download | php-git-013040516885ddf73a703e21b7d505037f0f3ea9.tar.gz |
fix bug #13479
-rw-r--r-- | ext/snmp/snmp.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index a5adb0070b..5ab5718a5e 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -271,6 +271,7 @@ void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st) { case 3: if (array_init(return_value) == FAILURE) { php_error(E_WARNING, "Cannot prepare result array"); + snmp_close(ss); RETURN_FALSE; } break; @@ -287,6 +288,7 @@ void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st) { name_length = MAX_NAME_LEN; if ( !read_objid(objid, name, &name_length) ) { php_error(E_WARNING,"Invalid object identifier: %s\n", objid); + snmp_close(ss); RETURN_FALSE; } snmp_add_null_var(pdu, name, name_length); @@ -294,6 +296,7 @@ void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st) { pdu = snmp_pdu_create(SNMP_MSG_SET); if (snmp_add_var(pdu, name, name_length, type, value)) { php_error(E_WARNING,"Could not add variable: %s\n", name); + snmp_close(ss); RETURN_FALSE; } } else if (st >= 2) { @@ -358,14 +361,17 @@ retry: goto retry; } } + snmp_close(ss); RETURN_FALSE; } } } else if (status == STAT_TIMEOUT) { php_error(E_WARNING,"No Response from %s\n", Z_STRVAL_PP(a1)); + snmp_close(ss); RETURN_FALSE; } else { /* status == STAT_ERROR */ php_error(E_WARNING,"An error occurred, Quitting...\n"); + snmp_close(ss); RETURN_FALSE; } if (response) { |