pkcs15init: fix bug introduced in 50f03bc

This commit is contained in:
Viktor Tarasov 2016-02-29 18:47:59 +01:00
parent 50f03bca3f
commit f29f2e62b3

View File

@ -1614,12 +1614,13 @@ sc_pkcs15init_store_public_key(struct sc_pkcs15_card *p15card, struct sc_profile
if (r >= 0) if (r >= 0)
r = sc_pkcs15init_add_object(p15card, profile, SC_PKCS15_PUKDF, object); r = sc_pkcs15init_add_object(p15card, profile, SC_PKCS15_PUKDF, object);
if (r >= 0 && res_obj)
*res_obj = object;
profile->dirty = 1; profile->dirty = 1;
err: err:
if (r >= 0 && res_obj) if (object && r < 0)
*res_obj = object;
else if (object)
sc_pkcs15init_free_object(object); sc_pkcs15init_free_object(object);
LOG_FUNC_RETURN(ctx, r); LOG_FUNC_RETURN(ctx, r);