Make freeing a NULL key pointer a no-op.
Allow passing NULL to afsconf_typedKey_values() when not all
values are needed.
Change-Id: I3a4088747913e9e88be094da891cd2cca0cbb114
Reviewed-on: http://gerrit.openafs.org/11783
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
void
afsconf_typedKey_free(struct afsconf_typedKey **key)
{
+ if (*key == NULL)
+ return;
rx_opaque_freeContents(&(*key)->key);
free(*key);
*key = NULL;
afsconf_typedKey_values(struct afsconf_typedKey *key, afsconf_keyType *type,
int *kvno, int *subType, struct rx_opaque **material)
{
- *type = key->type;
- *kvno = key->kvno;
- *subType = key->subType;
- *material = &key->key;
+ if (type != NULL)
+ *type = key->type;
+ if (kvno != NULL)
+ *kvno = key->kvno;
+ if (subType != NULL)
+ *subType = key->subType;
+ if (material != NULL)
+ *material = &key->key;
}
int