Introduce and use btp_realloc

Fixes rhbz#951432.

Signed-off-by: Martin Milata <mmilata@redhat.com>
Signed-off-by: Jakub Filak <jfilak@redhat.com>