Removed checks for NULL returns after osi_calloc() / osi_malloc()
Removed explicit checks for NULL pointer returns after calls
to osi_calloc() and osi_malloc(), because those are not needed.
If the memory allocation fails, osi_calloc() and osi_malloc()
will trigger an assert.
Bug: 27048759
Change-Id: I2791eb2f69c08f991f8fcdef10e101a41568cd95
diff --git a/bta/hl/bta_hl_utils.c b/bta/hl/bta_hl_utils.c
index 90024ad..8e5a4a7 100644
--- a/bta/hl/bta_hl_utils.c
+++ b/bta/hl/bta_hl_utils.c
@@ -268,20 +268,14 @@
*******************************************************************************/
BT_HDR * bta_hl_get_buf(UINT16 data_size, BOOLEAN fcs_use)
{
- BT_HDR *p_new;
- UINT16 size = data_size + L2CAP_MIN_OFFSET + BT_HDR_SIZE;
+ size_t size = data_size + L2CAP_MIN_OFFSET + BT_HDR_SIZE;
if (fcs_use)
- {
size += L2CAP_FCS_LEN;
- }
- p_new = (BT_HDR *)osi_malloc(size);
- if (p_new)
- {
- p_new->len = data_size;
- p_new->offset = L2CAP_MIN_OFFSET;
- }
+ BT_HDR *p_new = (BT_HDR *)osi_malloc(size);
+ p_new->len = data_size;
+ p_new->offset = L2CAP_MIN_OFFSET;
return p_new;
}