diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-01-18 11:29:36 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-01-18 19:30:12 +0000 |
commit | 3eb253b74811992ea2ac0e0db4f4897a6f83220d (patch) | |
tree | f4b8849ff4b1b7f5f3367e1a3fce2cc2567fbef7 /sharkd_session.c | |
parent | b0c0490fe073b19e1d67d928bc22c64666f8a48b (diff) |
Use separate pointers for the input expert info and the copy we make.
That eliminates the need for qualifier-removing casts.
Change-Id: I90728858ec43ddabf663f30258df6e9c41aa191a
Reviewed-on: https://code.wireshark.org/review/25378
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'sharkd_session.c')
-rw-r--r-- | sharkd_session.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sharkd_session.c b/sharkd_session.c index 6c17fdcc47..ba3a528d52 100644 --- a/sharkd_session.c +++ b/sharkd_session.c @@ -1100,16 +1100,18 @@ static gboolean sharkd_session_packet_tap_expert_cb(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *pointer) { struct sharkd_expert_tap *etd = (struct sharkd_expert_tap *) tapdata; - expert_info_t *ei = (expert_info_t *) pointer; + const expert_info_t *ei = (const expert_info_t *) pointer; + expert_info_t *ei_copy; - ei = (expert_info_t *) g_memdup(ei, sizeof(*ei)); - if (ei == NULL) + /* Note: this is a shallow copy */ + ei_copy = (expert_info_t *) g_memdup(ei, sizeof(*ei)); + if (ei_copy == NULL) return FALSE; - ei->protocol = g_string_chunk_insert_const(etd->text, ei->protocol); - ei->summary = g_string_chunk_insert_const(etd->text, ei->summary); + ei_copy->protocol = g_string_chunk_insert_const(etd->text, ei_copy->protocol); + ei_copy->summary = g_string_chunk_insert_const(etd->text, ei_copy->summary); - etd->details = g_slist_prepend(etd->details, ei); + etd->details = g_slist_prepend(etd->details, ei_copy); return TRUE; } |