aboutsummaryrefslogtreecommitdiffstats
path: root/epan/oids.c
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2013-09-12 12:16:15 +0000
committerEvan Huus <eapache@gmail.com>2013-09-12 12:16:15 +0000
commit2d128b70bdb90dfc55f5cf41357b90ec75056549 (patch)
tree6c60f4d8db46ea6a3b8ad221e168d775d3cf09a4 /epan/oids.c
parentc0d7a95f4edfd4228928cda62846a6ce70261ed7 (diff)
Use epan-scope memory for OIDs, cleaning up another ~100KB of valgrind
complaints. svn path=/trunk/; revision=51966
Diffstat (limited to 'epan/oids.c')
-rw-r--r--epan/oids.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/epan/oids.c b/epan/oids.c
index 06111b5054..9344a255c6 100644
--- a/epan/oids.c
+++ b/epan/oids.c
@@ -120,17 +120,10 @@ static oid_info_t* add_oid(const char* name, oid_kind_t kind, const oid_value_ty
if (!g_str_equal(n->name,name)) {
D(2,("Renaming Oid from: %s -> %s, this means the same oid is registered more than once",n->name,name));
}
- /* There used to be a comment here that claimed we couldn't free
- * n->name since it may be part of an hf_register_info struct
- * that has been appended to the hfa GArray. I think that comment
- * was wrong, because we only ever create oid_info_t's in this
- * function, and we are always careful here to g_strdup the name.
- * All that to justify freeing n->name in the next line, since
- * doing so fixes some memory leaks. */
- g_free(n->name);
+ wmem_free(wmem_epan_scope(), n->name);
}
- n->name = g_strdup(name);
+ n->name = wmem_strdup(wmem_epan_scope(), name);
if (! n->value_type) {
n->value_type = type;
@@ -139,7 +132,7 @@ static oid_info_t* add_oid(const char* name, oid_kind_t kind, const oid_value_ty
return n;
}
} else {
- n = (oid_info_t *)g_malloc(sizeof(oid_info_t));
+ n = wmem_new(wmem_epan_scope(), oid_info_t);
n->subid = subids[i];
n->kind = kind;
n->children = wmem_tree_new(wmem_epan_scope());
@@ -151,7 +144,7 @@ static oid_info_t* add_oid(const char* name, oid_kind_t kind, const oid_value_ty
wmem_tree_insert32(c->children,n->subid,n);
if (i == oid_len) {
- n->name = g_strdup(name);
+ n->name = wmem_strdup(wmem_epan_scope(), name);
n->value_type = type;
n->kind = kind;
return n;