diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-03-18 23:17:37 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-03-18 23:17:37 +0000 |
commit | fcbc87af9860b05ccef2d17327c28b8e608f8158 (patch) | |
tree | 125225fa1c946c89b3efec8b37061b675c62c08c /usr.sbin | |
parent | d3331f822103a66c7b4ee03841e93ccc72f8b0ad (diff) |
do not leak on re-insert; ok pvalchev
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ypserv/revnetgroup/hash.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.sbin/ypserv/revnetgroup/hash.c b/usr.sbin/ypserv/revnetgroup/hash.c index df247b12332..d5c45b8d862 100644 --- a/usr.sbin/ypserv/revnetgroup/hash.c +++ b/usr.sbin/ypserv/revnetgroup/hash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hash.c,v 1.4 2003/07/15 06:10:46 deraadt Exp $ */ +/* $OpenBSD: hash.c,v 1.5 2006/03/18 23:17:36 deraadt Exp $ */ /* * Copyright (c) 1995 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -40,7 +40,7 @@ #include "hash.h" #ifndef lint -static const char rcsid[] = "$OpenBSD: hash.c,v 1.4 2003/07/15 06:10:46 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: hash.c,v 1.5 2006/03/18 23:17:36 deraadt Exp $"; #endif /* @@ -188,11 +188,14 @@ mstore(struct member_entry *table[], char *key, char *data, char *domain) /* Check if all we have to do is insert a new groupname. */ while (cur) { - if (!strcmp(cur->key, key) && !strcmp(cur->domain,domain)) { + if (!strcmp(cur->key, key) && !strcmp(cur->domain, domain)) { p = cur->groups; while (p) { - if (!strcmp(p->groupname,data)) + if (!strcmp(p->groupname, data)) { + free(tmp->groupname); + free(tmp); return; + } p = p->next; } tmp->next = cur->groups; |