diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-03-08 18:02:21 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-03-09 02:03:15 +0000 |
commit | 7ffc4f96ebe2fac503cb251a848441ad8d4bad8c (patch) | |
tree | 35a3b7dbaa8553e0779e06e9233b17a4b7bdb46c /ui | |
parent | 6e32335be61851592d8158772b743c55ae132eb9 (diff) |
When looking up response codes, just keep the key on the stack.
We don't need to dynamically allocate a guint variable to hold the
response code value - and then not bother to free it! - if we're just
doing a lookup; we can use an automatic variable and pass a pointer to
it.
Change-Id: I6edbb352f0aa33c91ede0f4e1bbb962fa921bea2
Reviewed-on: https://code.wireshark.org/review/26375
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/cli/tap-sipstat.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ui/cli/tap-sipstat.c b/ui/cli/tap-sipstat.c index 090605b01a..7a964f4ef0 100644 --- a/ui/cli/tap-sipstat.c +++ b/ui/cli/tap-sipstat.c @@ -287,12 +287,12 @@ sipstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const if (value->response_code != 0) { /* Responses */ - guint *key = g_new(guint, 1); + guint key; sip_response_code_t *sc; /* Look up response code in hash table */ - *key = value->response_code; - sc = (sip_response_code_t *)g_hash_table_lookup(sp->hash_responses, key); + key = value->response_code; + sc = (sip_response_code_t *)g_hash_table_lookup(sp->hash_responses, &key); if (sc == NULL) { /* Non-standard status code ; we classify it as others @@ -307,31 +307,31 @@ sipstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const } else if (i < 200) { - *key = 199; /* Hopefully, this status code will never be used */ + key = 199; /* Hopefully, this status code will never be used */ } else if (i < 300) { - *key = 299; + key = 299; } else if (i < 400) { - *key = 399; + key = 399; } else if (i < 500) { - *key = 499; + key = 499; } else if (i < 600) { - *key = 599; + key = 599; } else { - *key = 699; + key = 699; } /* Now look up this fallback code to get its text description */ - sc = (sip_response_code_t *)g_hash_table_lookup(sp->hash_responses, key); + sc = (sip_response_code_t *)g_hash_table_lookup(sp->hash_responses, &key); if (sc == NULL) { return 0; |