diff options
author | Dario Lombardo <lomato@gmail.com> | 2018-01-19 10:24:11 +0100 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2018-01-19 12:24:27 +0000 |
commit | 4444561ef83df484bb098af87afbe1299f0c4f24 (patch) | |
tree | 570a078e32ae06ad7786987b4b8a2af8ddb19046 /ui/tap-sctp-analysis.c | |
parent | b31cda28f7329a76b5eec1583a18441e8e7f86e4 (diff) |
tap-sctp: change if to switch for a default case (found by clang).
Change-Id: I5158c1db63258e194cdad987529019069e537ab3
Reviewed-on: https://code.wireshark.org/review/25387
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'ui/tap-sctp-analysis.c')
-rw-r--r-- | ui/tap-sctp-analysis.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/ui/tap-sctp-analysis.c b/ui/tap-sctp-analysis.c index 960e921ef0..41f78139df 100644 --- a/ui/tap-sctp-analysis.c +++ b/ui/tap-sctp-analysis.c @@ -855,10 +855,17 @@ packet(void *tapdata _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const voi memcpy(addr,(tmp_info.src.data),tmp_info.src.len); store->data = addr; - if (info->direction == 1) - info = add_address(store, info, 1); - else if (info->direction == 2) - info = add_address(store, info, 2); + switch (info->direction) { + case 1: + info = add_address(store, info, 1); + break; + case 2: + info = add_address(store, info, 2); + break; + default: + g_free(store); + break; + } store = (address *)g_malloc(sizeof (address)); store->type = tmp_info.dst.type; @@ -867,10 +874,17 @@ packet(void *tapdata _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const voi memcpy(addr,(tmp_info.dst.data),tmp_info.dst.len); store->data = addr; - if (info->direction == 1) - info = add_address(store, info, 2); - else if (info->direction == 2) - info = add_address(store, info, 1); + switch (info->direction) { + case 1: + info = add_address(store, info, 2); + break; + case 2: + info = add_address(store, info, 1); + break; + default: + g_free(store); + break; + } if (((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_INIT_ACK_CHUNK_ID) || ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_INIT_CHUNK_ID)) |