It is not clear why are you creating the sendBuffer in the heap rather than on the stack, but if you do so - please, don't forget to :
Code:
    delete [] sendBuffer;
before returning!