diff options
author | Guy Harris <guy@alum.mit.edu> | 2012-01-25 23:03:33 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2012-01-25 23:03:33 +0000 |
commit | 6f59700722eeba702a7dfdff6b84f5940744996b (patch) | |
tree | cbf2428dc4c8c7651e4fd812cc80162714d9b6f0 /epan/uat.h | |
parent | 3d3346bc7e8fc45a1f7cbbaf23de05a64f0d8f52 (diff) |
Fix usage of g_ascii_strdown() and g_ascii_strup() - they do *not*
modify the string in place, they return a g_mallocated modified version
of the string passed into them.
svn path=/trunk/; revision=40727
Diffstat (limited to 'epan/uat.h')
-rw-r--r-- | epan/uat.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/epan/uat.h b/epan/uat.h index 90a8cde9fa..53806ab9fa 100644 --- a/epan/uat.h +++ b/epan/uat.h @@ -511,7 +511,10 @@ static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out #define UAT_PROTO_DEF(basename, field_name, dissector_field, name_field, rec_t) \ static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, unsigned len, const void* u1 _U_, const void* u2 _U_) {\ if (len) { \ - ((rec_t*)rec)->name_field = g_strndup(buf,len); g_ascii_strdown(((rec_t*)rec)->name_field, -1); g_strchug(((rec_t*)rec)->name_field); \ + gchar *tmp = g_strndup(buf,len); \ + ((rec_t*)rec)->name_field = g_ascii_strdown(tmp, -1); \ + g_free(tmp); \ + g_strchug(((rec_t*)rec)->name_field); \ ((rec_t*)rec)->dissector_field = find_dissector(((rec_t*)rec)->name_field); \ } else { \ ((rec_t*)rec)->dissector_field = find_dissector("data"); \ |