Fixed some memory leaks

Return value of `hex_string_to_bin()` sometimes wasn't freed.