fix typo on *paramp test.

check alg_info always, not only in some case.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2720 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
aj 2005-12-05 21:49:59 +00:00
parent 252fa4b868
commit e49f78a360
1 changed files with 6 additions and 6 deletions

View File

@ -103,7 +103,7 @@ asn1_decode_pbkdf2_params(sc_context_t *ctx, void **paramp,
return r;
*paramp = malloc(sizeof(info));
if (*paramp)
if (!*paramp)
return SC_ERROR_OUT_OF_MEMORY;
memcpy(*paramp, &info, sizeof(info));
return 0;
@ -335,14 +335,14 @@ sc_asn1_encode_algorithm_id(sc_context_t *ctx,
u8 *tmp;
alg_info = sc_asn1_get_algorithm_info(id);
if (alg_info == NULL) {
sc_error(ctx, "Cannot encode unknown algorithm %u.\n",
id->algorithm);
return SC_ERROR_INVALID_ARGUMENTS;
}
/* Set the oid if not yet given */
if (id->obj_id.value[0] <= 0) {
if (alg_info == NULL) {
sc_error(ctx, "Cannot encode unknown algorithm %u.\n",
id->algorithm);
return SC_ERROR_INVALID_ARGUMENTS;
}
temp_id = *id;
temp_id.obj_id = alg_info->oid;
id = &temp_id;