diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-08-31 07:42:31 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-08-31 07:42:44 +0000 |
commit | 5fea2b5f4198f1a36f313ef38532ddffd02ac5b1 (patch) | |
tree | 29d44f8569f4c4d17c93e38a5e309ab6d9f7e347 /epan/diam_dict.l | |
parent | c8869f68db6cd1d4a341d57600ecf22627632c9f (diff) | |
download | wireshark-5fea2b5f4198f1a36f313ef38532ddffd02ac5b1.tar.gz |
Revert "diameter: fix 400kb leaked memory on exit"
This reverts commit a04b6fcb3db901734ed948134c973996786be8b7.
Temporary revert to see if this prevents the "tshark -G" crashes being seen on the 64-bit Windows buildbot.
Change-Id: I561439039ca2667b72d7e2319a6f3f5f97e18d15
Reviewed-on: https://code.wireshark.org/review/17412
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/diam_dict.l')
-rw-r--r-- | epan/diam_dict.l | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/epan/diam_dict.l b/epan/diam_dict.l index 0fbb3e697f..75a320a69f 100644 --- a/epan/diam_dict.l +++ b/epan/diam_dict.l @@ -749,8 +749,8 @@ ddict_scan(const char* system_directory, const char* filename, int dbg) state.dict = g_new(ddict_t,1); state.dict->applications = NULL; - state.dict->vendors = NULL; state.dict->cmds = NULL; + state.dict->vendors = NULL; state.dict->typedefns = NULL; state.dict->avps = NULL; state.dict->xmlpis = NULL; @@ -796,7 +796,6 @@ ddict_scan(const char* system_directory, const char* filename, int dbg) } if (DiamDict_lex_init(&scanner) != 0) { - /* Note: cannot be reached since memory allocation failure terminates early */ D(("Can't initialize scanner: %s\n", g_strerror(errno))); fclose(in); g_free(state.dict); @@ -828,7 +827,6 @@ ddict_scan(const char* system_directory, const char* filename, int dbg) state.current_yyinput = string_input; if (DiamDict_lex_init(&scanner) != 0) { - /* Note: cannot be reached since memory allocation failure terminates early */ D(("Can't initialize scanner: %s\n", g_strerror(errno))); g_free(state.dict); g_free(state.strbuf); @@ -842,16 +840,6 @@ ddict_scan(const char* system_directory, const char* filename, int dbg) DiamDict_lex(scanner); DiamDict_lex_destroy(scanner); - { - entity_t *e, *en; - - for (e = state.ents; e; e = en) { - en = e->next; - g_free(e->name); - g_free(e->file); - g_free(e); - } - } g_free(state.strbuf); return state.dict; @@ -865,9 +853,8 @@ ddict_free(ddict_t* d) ddict_cmd_t *c, *cn; ddict_typedefn_t *t, *tn; ddict_avp_t *a, *an; - ddict_xmlpi_t *x, *xn; -#define FREE_NAMEANDOBJ(n) do { g_free(n->name); g_free(n); } while(0) +#define FREE_NAMEANDOBJ(n) do { if(n->name) g_free(n->name); g_free(n); } while(0) for (p = d->applications; p; p = pn ) { pn = p->next; @@ -876,19 +863,18 @@ ddict_free(ddict_t* d) for (v = d->vendors; v; v = vn) { vn = v->next; - g_free(v->desc); + if (v->desc) g_free(v->desc); FREE_NAMEANDOBJ(v); } for (c = d->cmds; c; c = cn ) { cn = c->next; - g_free(c->vendor); FREE_NAMEANDOBJ(c); } for (t = d->typedefns; t; t = tn) { tn = t->next; - g_free(t->parent); + if (t->parent) g_free(t->parent); FREE_NAMEANDOBJ(t); } @@ -907,19 +893,12 @@ ddict_free(ddict_t* d) FREE_NAMEANDOBJ(e); } - g_free(a->vendor); - g_free(a->type); - g_free(a->description); + if (a->vendor) g_free(a->vendor); + if (a->type) g_free(a->type); + if (a->description) g_free(a->description); FREE_NAMEANDOBJ(a); } - for (x = d->xmlpis; x; x = xn) { - xn = x->next; - g_free(x->key); - g_free(x->value); - FREE_NAMEANDOBJ(x); - } - g_free(d); } |