I would like to know if there is any command or way of knowing the memory allocated from a pointer in the following conditions:

MyPointer is a char pointer (char *MyPointer)
It has 300 bytes allocated to be used! Type using malloc
It stores the text: cprogramming (12 Bytes)

How do I know how many allocated bytes (memory allocated) have my pointer?
That is, what command can I use to result in 300?