aboutsummaryrefslogtreecommitdiffstats
path: root/epan/oids.c
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2013-07-14 01:02:44 +0000
committerEvan Huus <eapache@gmail.com>2013-07-14 01:02:44 +0000
commitb54d5b7d544a7c8340747c4d1c46221cf043fb9a (patch)
tree47cf30f41636fcb3df2114bb3fcf24c8af6e12c3 /epan/oids.c
parentc7909c4195c5c633454d9874b7db871f9c54baf1 (diff)
Fix the OID registration leaks.
Only 1,625 bytes to go... svn path=/trunk/; revision=50565
Diffstat (limited to 'epan/oids.c')
-rw-r--r--epan/oids.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/epan/oids.c b/epan/oids.c
index c93370e884..0f29461ab9 100644
--- a/epan/oids.c
+++ b/epan/oids.c
@@ -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