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.

CC2640R2F: proper allocation/de-allocation function use

Part Number: CC2640R2F

I need to use function:

bStatus_t GATT_ReliableWrites ( uint16 connHandle,
    attPrepareWriteReq_t * pReqs,
    uint8 numReqs,
    uint8 flags,
    uint8 taskId
)

So I am allocating pReqs using GATT_bm_alloc(connection.connHandle, ATT_PREPARE_WRITE_REQ, sizeof(attPrepareWriteReq_t), NULL)

Q1: is ATT_PREPARE_WRITE_REQ correct argument?

Now I have allocated structure with name req.

This structure stores pointer to data (pValue), so I have to allocate it too.

Q2: should I use GATT_bm_alloc again (with some/different opcode?) or rather BM_alloc?

Q3: How should be de-allocation handled in case of GATT_ReliableWrites fail? Which free function to use? Do I have to free both allocated resources manually or would GATT_bm_free also handle freeing of pValue buffer?

Preferred answers would be pointers to documentation explaining proper use. Next time, I'd like to be able to answer such question by myself...