diff options
author | Evan Huus <eapache@gmail.com> | 2013-10-25 22:14:25 +0000 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2013-10-25 22:14:25 +0000 |
commit | 95f484a91ee34ea3caa2c325170e52d0bf07489b (patch) | |
tree | 83a02ff6f4f38f36c739e437881a432c75eb88b6 /epan/uat_load.l | |
parent | 7a3febacac8fd14009dc82dc4d139ee43d37a437 (diff) |
Add a very small hack to make the UAT update callback error string freeable, and
convert all existing UAT update callbacks to use glib memory instead of
ephemeral memory for that string.
UAT code paths are entirely distinct from packet dissection, so using ephemeral
memory was the wrong choice, because there was no guarantees about when it would
be freed.
The move away from emem still needs to be propogated deeper into the UAT code
itself at some point.
Net effect: remove another bunch of emem calls from dissectors, where replacing
with wmem would have caused assertions.
svn path=/trunk/; revision=52854
Diffstat (limited to 'epan/uat_load.l')
-rw-r--r-- | epan/uat_load.l | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/epan/uat_load.l b/epan/uat_load.l index 117bb3355c..dd42dd80b3 100644 --- a/epan/uat_load.l +++ b/epan/uat_load.l @@ -81,7 +81,10 @@ static guint linenum; static gchar *parse_str; static guint parse_str_pos; -#define ERROR(fmtd) do { error = ep_strdup_printf("%s:%d: %s",uat->filename,linenum,ep_strdup_printf fmtd); yyterminate(); } while(0) +#define ERROR(fmtd) do { \ + error = ep_strdup_printf("%s:%d: %s",uat->filename,linenum,ep_strdup_printf fmtd); \ + yyterminate(); \ +} while(0) #define SET_FIELD() \ { const gchar* errx; \ @@ -237,7 +240,7 @@ comment #[^\n]*\n <END_OF_RECORD>{newline} { void* rec; - const gchar* err = NULL; + const char* err = NULL; linenum++; @@ -251,7 +254,12 @@ comment #[^\n]*\n uat->update_cb(rec,&err); if (err) { - ERROR(("%s",err)); + char *tmp = ep_strdup(err); + /* XXX bit of a hack to remove emem from dissectors, this can + * be removed as proper use of glib memory is propogated + * through the rest of the UAT code */ + g_free((char*)err); + ERROR(("%s",tmp)); } valid_record = TRUE; |