libctrl: only free() msgb if it was alloc()ed

Before this patch a SIGABRT was caused when doing e.g.:
$ ncat 127.0.0.1 4249
^C
1 file changed