Fix the OID registration leaks.

Only 1,625 bytes to go...

svn path=/trunk/; revision=50565
This commit is contained in:
Evan Huus 2013-07-14 01:02:44 +00:00
parent c7909c4195
commit b54d5b7d54
1 changed files with 9 additions and 7 deletions

View File

@ -32,6 +32,7 @@
#include <ctype.h>
#include "emem.h"
#include "wmem/wmem.h"
#include "uat.h"
#include "prefs.h"
#include "proto.h"
@ -519,8 +520,8 @@ static void register_mibs(void) {
SmiNode *smiNode;
guint i;
int proto_mibs = -1;
GArray* hfa = g_array_new(FALSE,TRUE,sizeof(hf_register_info));
GArray* etta = g_array_new(FALSE,TRUE,sizeof(gint*));
wmem_array_t* hfa;
GArray* etta;
gchar* path_str;
if (!load_smi_modules) {
@ -537,6 +538,9 @@ static void register_mibs(void) {
oids_init_done = TRUE;
}
hfa = wmem_array_new(wmem_epan_scope(), sizeof(hf_register_info));
etta = g_array_new(FALSE,TRUE,sizeof(gint*));
smiInit(NULL);
smi_errors = g_string_new("");
@ -682,7 +686,7 @@ static void register_mibs(void) {
g_array_append_val(hfa,hf2);
}
#endif /* packet-snmp does not use this yet */
g_array_append_val(hfa,hf);
wmem_array_append_one(hfa,hf);
}
if ((key = oid_data->key)) {
@ -701,7 +705,7 @@ static void register_mibs(void) {
key->name, key->num_subids, key->key_type ));
if (key->hfid == -2) {
g_array_append_val(hfa,hf);
wmem_array_append_one(hfa,hf);
key->hfid = -1;
} else {
g_free((void*)hf.hfinfo.abbrev);
@ -713,13 +717,11 @@ static void register_mibs(void) {
proto_mibs = proto_register_protocol("MIBs", "MIBS", "mibs");
proto_register_field_array(proto_mibs, (hf_register_info*)(void*)hfa->data, hfa->len);
proto_register_field_array(proto_mibs, (hf_register_info*)wmem_array_get_raw(hfa), wmem_array_get_count(hfa));
proto_register_subtree_array((gint**)(void*)etta->data, etta->len);
g_array_free(etta,TRUE);
g_array_free(hfa,FALSE);
}
#endif