btavdtp: fix An unconditional 'break' within a loop found by PVS Studio (V612)
authorAlexis La Goutte <alexis.lagoutte@gmail.com>
Tue, 1 Dec 2015 13:59:51 +0000 (14:59 +0100)
committerAnders Broman <a.broman58@gmail.com>
Mon, 7 Dec 2015 07:15:58 +0000 (07:15 +0000)
Change-Id: Ic96f670bd4b039e12cdd467b8cc59470dd1553f3
Reviewed-on: https://code.wireshark.org/review/12331
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
epan/dissectors/packet-btavdtp.c

index 91a81cc626f23a7138888404eea2746565540d89..a4c391a85129fd904c0d66b254de3debcea662fd 100644 (file)
@@ -2795,7 +2795,7 @@ dissect_aptx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
 
     proto_tree_add_item(aptx_tree, hf_aptx_data, tvb, 0, -1, ENC_NA);
 
-    while (info && info->configuration && info->configuration_length >= 9) {
+    if (info && info->configuration && info->configuration_length >= 9) {
         gboolean fail = FALSE;
         gdouble expected_speed_data;
         gdouble frame_duration;
@@ -2822,7 +2822,7 @@ dissect_aptx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
         }
 
         if (fail)
-            break;
+            return tvb_reported_length(tvb);
 
         switch (info->configuration[8] & 0x0F) {
         case 0x01:
@@ -2838,7 +2838,7 @@ dissect_aptx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
         }
 
         if (fail)
-            break;
+            return tvb_reported_length(tvb);
 
         sample_bits = 16;
 
@@ -2879,8 +2879,6 @@ dissect_aptx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
             proto_item_append_text(pitem, " ms");
             PROTO_ITEM_SET_GENERATED(pitem);
         }
-
-        break;
     }
 
     return tvb_reported_length(tvb);