This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/CC2640R2F: Heap release after GATT_WriteCharValue()

Part Number: CC2640R2F
Other Parts Discussed in Thread: BLE-STACK

Tool/software: TI-RTOS

I am using the simple central example now, and I have a problem that makes me confused:

The following code is used to send data to the peripheral device. Before the GATT_WriteCharValue() is called, GATT_bm_alloc() is used to allocate from the heap. But After the GATT_WriteCharValue() , the heap is released only when status != SUCCESS .  if status == SUCCESS, will the heap be released ?  where is it ?

                req.pValue = GATT_bm_alloc(app_connect_handle, ATT_WRITE_REQ, 1, NULL);
                if ( req.pValue != NULL )
                {
                    req.handle = user_char_notify_cccd_handle;
                    req.len = 2;
                    req.pValue[0] = 0x01;
                    req.pValue[1] = 0x00;
                    req.sig = 0;
                    req.cmd = 0;

                    status = GATT_WriteCharValue(app_connect_handle, &req, selfEntity);
                    if ( status != SUCCESS )
                    {
                        GATT_bm_free((gattMsg_t *)&req, ATT_WRITE_REQ);
                    }
                }
                else
                {
                    status = bleMemAllocError;
                }