aboutsummaryrefslogtreecommitdiffstats
path: root/epan/diam_dict.l
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2016-08-31 17:55:15 +0200
committerGuy Harris <guy@alum.mit.edu>2016-08-31 16:52:27 +0000
commit5c2d82a6c24a06da0132fb7bd493ce4e58594f0d (patch)
treef778737b4609b8cad86220962107780634446905 /epan/diam_dict.l
parenta7dd070d55e41e76da5a3c595d3f547c8cf3837b (diff)
diam_dict.l: remove use of strdup
This should fix crashes on Windows, _strdup should not be mixed with g_free. This was only uncovered in v2.3.0rc0-474-ga04b6fc, before that ddict_free was never called. Change-Id: I34111385c82715de70fb42fe44b99b89e132a374 Reviewed-on: https://code.wireshark.org/review/17423 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/diam_dict.l')
-rw-r--r--epan/diam_dict.l22
1 files changed, 6 insertions, 16 deletions
diff --git a/epan/diam_dict.l b/epan/diam_dict.l
index 0fbb3e697f..7c4195caa8 100644
--- a/epan/diam_dict.l
+++ b/epan/diam_dict.l
@@ -94,16 +94,6 @@
#include <epan/to_str.h>
#include <wsutil/file_util.h>
-/*
- * Deprecated CRT functions. We call malloc+free quite a bit here. We could
- * probably improve startup performance by using wmem instead.
- */
-#ifdef _WIN32
-#define ws_strdup _strdup
-#else
-#define ws_strdup strdup
-#endif
-
typedef struct entity_t {
char* name;
char* file;
@@ -294,10 +284,10 @@ description_attr description=\042
}
<XMLPI_ATTRS>{xmlpi_key_attr} BEGIN XMLPI_GETKEY;
-<XMLPI_GETKEY>{ndquot} { yyextra->xmlpi->key = ws_strdup(yytext); BEGIN XMLPI_ATTRS; }
+<XMLPI_GETKEY>{ndquot} { yyextra->xmlpi->key = g_strdup(yytext); BEGIN XMLPI_ATTRS; }
<XMLPI_ATTRS>{xmlpi_value_attr} BEGIN XMLPI_GETVAL;
-<XMLPI_GETVAL>{ndquot} { yyextra->xmlpi->value = ws_strdup(yytext); BEGIN XMLPI_ATTRS; }
+<XMLPI_GETVAL>{ndquot} { yyextra->xmlpi->value = g_strdup(yytext); BEGIN XMLPI_ATTRS; }
<XMLPI_ATTRS>.
<XMLPI_ATTRS>{xmlpi_end} BEGIN LOADING;
@@ -306,14 +296,14 @@ description_attr description=\042
<LOADING>{start_entity} BEGIN ENTITY;
<ENTITY>{entityname} {
entity_t* e = g_new(entity_t,1);
- e->name = ws_strdup(yytext);
+ e->name = g_strdup(yytext);
e->next = yyextra->ents;
yyextra->ents = e;
BEGIN GET_SYSTEM;
};
<GET_SYSTEM>{system} BEGIN GET_FILE;
<GET_FILE>{ndquot} {
- yyextra->ents->file = ws_strdup(yytext);
+ yyextra->ents->file = g_strdup(yytext);
BEGIN END_ENTITY;
}
<END_ENTITY>{end_entity} BEGIN LOADING;
@@ -394,7 +384,7 @@ description_attr description=\042
<GET_ATTR>{ndquot} {
- *(yyextra->attr_str) = ws_strdup(yytext);
+ *(yyextra->attr_str) = g_strdup(yytext);
D(("%s\n",yytext));
yyextra->attr_str = NULL;
BEGIN END_ATTR;
@@ -550,7 +540,7 @@ description_attr description=\042
<AVP_ATTRS>{stop_end} { BEGIN IN_APPL; }
-<IN_AVP>{grouped_start} { yyextra->avp->type = ws_strdup("Grouped"); };
+<IN_AVP>{grouped_start} { yyextra->avp->type = g_strdup("Grouped"); };
<IN_AVP>{grouped_end} ;
<IN_AVP>{type_start} { BEGIN TYPE_ATTRS; }