[Issue 10349] Free ch_calloc-allocated memory in error paths