mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-02-06 00:39:59 +00:00
SNMP: Found the correct cause of a memory leak
This commit is contained in:
parent
e033866651
commit
fbdfba2509
@ -244,6 +244,12 @@ snmp_process_varbind(struct snmp_request *request, struct snmp_varbind *vb, u8_t
|
||||
if (request->error_status == SNMP_ERR_NOERROR) {
|
||||
/* use 'getnext_validate' method for validation to avoid code duplication (some checks have to be executed here) */
|
||||
request->error_status = snmp_msg_getnext_validate_node_inst(&node_instance, request);
|
||||
|
||||
if (request->error_status != SNMP_ERR_NOERROR) {
|
||||
if (node_instance.release_instance != NULL) {
|
||||
node_instance.release_instance(&node_instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -280,10 +286,10 @@ snmp_process_varbind(struct snmp_request *request, struct snmp_varbind *vb, u8_t
|
||||
} else if (err != ERR_OK) {
|
||||
request->error_status = SNMP_ERR_GENERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (node_instance.release_instance != NULL) {
|
||||
node_instance.release_instance(&node_instance);
|
||||
if (node_instance.release_instance != NULL) {
|
||||
node_instance.release_instance(&node_instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,13 +194,17 @@ do_sync(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* ins
|
||||
call_data->arg2.root_oid_len = root_oid_len;
|
||||
call_synced_function(call_data, fn);
|
||||
|
||||
instance->access = call_data->proxy_instance.access;
|
||||
instance->asn1_type = call_data->proxy_instance.asn1_type;
|
||||
instance->release_instance = threadsync_release_instance;
|
||||
instance->get_value = (call_data->proxy_instance.get_value != NULL)? threadsync_get_value : NULL;
|
||||
instance->set_value = (call_data->proxy_instance.set_value != NULL)? threadsync_set_value : NULL;
|
||||
instance->set_test = (call_data->proxy_instance.set_test != NULL)? threadsync_set_test : NULL;
|
||||
snmp_oid_assign(&instance->instance_oid, call_data->proxy_instance.instance_oid.id, call_data->proxy_instance.instance_oid.len);
|
||||
if(call_data->retval.u8 == SNMP_ERR_NOERROR) {
|
||||
instance->access = call_data->proxy_instance.access;
|
||||
instance->asn1_type = call_data->proxy_instance.asn1_type;
|
||||
instance->release_instance = threadsync_release_instance;
|
||||
instance->get_value = (call_data->proxy_instance.get_value != NULL)? threadsync_get_value : NULL;
|
||||
instance->set_value = (call_data->proxy_instance.set_value != NULL)? threadsync_set_value : NULL;
|
||||
instance->set_test = (call_data->proxy_instance.set_test != NULL)? threadsync_set_test : NULL;
|
||||
snmp_oid_assign(&instance->instance_oid, call_data->proxy_instance.instance_oid.id, call_data->proxy_instance.instance_oid.len);
|
||||
} else {
|
||||
mem_free(call_data);
|
||||
}
|
||||
|
||||
return call_data->retval.u8;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user