-/* $OpenBSD: pfkeyv2_convert.c,v 1.52 2015/05/25 18:48:17 benno Exp $ */
+/* $OpenBSD: pfkeyv2_convert.c,v 1.53 2015/05/25 22:18:38 benno Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@keromytis.org)
*
static void
import_identity(struct ipsec_id **id, struct sadb_ident *sadb_ident)
{
- if (!sadb_ident)
+ if (!sadb_ident) {
+ *id = NULL;
return;
+ }
*id = malloc(EXTLEN(sadb_ident) - sizeof(struct sadb_ident) +
sizeof(struct ipsec_id), M_CREDENTIALS, M_WAITOK);
if (*ids == tmp)
return;
}
- if (tmp->id_local != NULL)
- free(tmp->id_local, M_CREDENTIALS, 0);
- if (tmp->id_remote != NULL)
- free(tmp->id_remote, M_CREDENTIALS, 0);
+ free(tmp->id_local, M_CREDENTIALS, 0);
+ free(tmp->id_remote, M_CREDENTIALS, 0);
free(tmp, M_CREDENTIALS, 0);
}