Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 43ca2f0a authored by Andre Eisenbach's avatar Andre Eisenbach Committed by Matthew Xie
Browse files

LE: Add NULL pointer check in deep copy function

Adds a NULL pointer check for the GATT read event deep copy function.

Change-Id: Ia8d31e851589612009e1038c11b7b113e5367c6d
parent 198332b3
Loading
Loading
Loading
Loading
+24 −13
Original line number Diff line number Diff line
@@ -162,6 +162,9 @@ static void btapp_gattc_req_data(UINT16 event, char *p_dest, char *p_src)
    {
        case BTA_GATTC_READ_CHAR_EVT:
        case BTA_GATTC_READ_DESCR_EVT:

            if (p_src_data->read.p_value != NULL)
            {
                p_dest_data->read.p_value = GKI_getbuf(sizeof(tBTA_GATT_READ_VAL));

                if (p_dest_data->read.p_value != NULL)
@@ -183,6 +186,14 @@ static void btapp_gattc_req_data(UINT16 event, char *p_dest, char *p_src)
                        }
                    }
                }
            }
            else
            {
                BTIF_TRACE_WARNING2("%s :Src read.p_value ptr is NULL for event  0x%x",
                                    __FUNCTION__, event);
                p_dest_data->read.p_value = NULL;

            }
            break;

        default:
+1 −1
Original line number Diff line number Diff line
@@ -240,7 +240,7 @@ uint16_t set_read_value(btgatt_read_params_t *p_dest, tBTA_GATTC_READ *p_src)
            break;

        default:
            if ( p_src->status == BTA_GATT_OK )
            if (( p_src->status == BTA_GATT_OK ) &&(p_src->p_value != NULL))
            {
                ALOGI("%s unformat.len = %d ", __FUNCTION__, p_src->p_value->unformat.len);
                p_dest->value.len = p_src->p_value->unformat.len;