Current code in some codepaths neither discards nor reports errors. Properly surface the error. While on it split 2 cases of unrelated variables both named err. Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>