Minor code quality improvements.

Basically checks that the memory allocation succeed.

The ctbcs.c change improve the readability
because count = 0 and len > 254 does not add any value.

VTA: added few coding style changes
latest commit 8ea328ff7f
@vletoux vletoux authored viktorTarasov committed