OSDN Git Service

Fix for issues reported by Static analysis tool.
authorSatheesh Kumar Pallemoni <palsat@codeaurora.org>
Wed, 7 Dec 2016 05:52:24 +0000 (11:22 +0530)
committerGerrit - the friendly Code Review server <code-review@localhost>
Wed, 7 Dec 2016 09:04:46 +0000 (01:04 -0800)
Fix for issues reported by Static analysis tool.

Change-Id: Iacc558f34fb9ed0d970fc034e865d964da98609a
CRs-Fixed: 1095995

btif/src/btif_media_task.c
stack/gatt/gatt_db.c

index ce39d22..f2327c0 100644 (file)
@@ -1086,11 +1086,14 @@ static BOOLEAN btif_media_task_is_aptx_configured()
         UINT8* ptr = bta_av_co_get_current_codecInfo();
         if (ptr) {
             tA2D_APTX_CIE* codecInfo = (tA2D_APTX_CIE*) &ptr[BTA_AV_CFG_START_IDX];
+            /* Fix for below Klockwork Issue
+             * Pointer 'codecInfo' checked for NULL at line 1089 may be dereferenced at line 1092.*/
             if ((codecInfo && codecInfo->vendorId == A2D_APTX_VENDOR_ID && codecInfo->codecId == A2D_APTX_CODEC_ID_BLUETOOTH)
-                || (codecInfo && codecInfo->vendorId == A2D_APTX_HD_VENDOR_ID && codecInfo->codecId == A2D_APTX_HD_CODEC_ID_BLUETOOTH))
+                || (codecInfo && codecInfo->vendorId == A2D_APTX_HD_VENDOR_ID && codecInfo->codecId == A2D_APTX_HD_CODEC_ID_BLUETOOTH)) {
                 APPL_TRACE_DEBUG("%s codecId %d", __func__, codecInfo->codecId);
                 APPL_TRACE_DEBUG("%s vendorId %x", __func__, codecInfo->vendorId);
                 result = TRUE;
+            }
         }
     }
     return result;
index cffcc70..f5d63e6 100644 (file)
@@ -990,14 +990,16 @@ static void *allocate_attr_in_db(tGATT_SVC_DB *p_db, tBT_UUID *p_uuid, tGATT_PER
     }
     else if (p_attr16->uuid_type == GATT_ATTR_UUID_TYPE_32)
     {
-        GATT_TRACE_DEBUG("=====> handle = [0x%04x] uuid32 = [0x%08x] perm=0x%02x ",
-                          p_attr32->handle, p_attr32->uuid, p_attr32->permission);
+        if (p_attr32)
+           GATT_TRACE_DEBUG("=====> handle = [0x%04x] uuid32 = [0x%08x] perm=0x%02x ",
+                             p_attr32->handle, p_attr32->uuid, p_attr32->permission);
     }
     else
     {
-        GATT_TRACE_DEBUG("=====> handle = [0x%04x] uuid128 = [0x%02x:0x%02x] perm=0x%02x ",
-                          p_attr128->handle, p_attr128->uuid[0],p_attr128->uuid[1],
-                          p_attr128->permission);
+        if (p_attr128)
+           GATT_TRACE_DEBUG("=====> handle = [0x%04x] uuid128 = [0x%02x:0x%02x] perm=0x%02x ",
+                             p_attr128->handle, p_attr128->uuid[0],p_attr128->uuid[1],
+                             p_attr128->permission);
     }
     return(void *)p_attr16;
 }