summaryrefslogtreecommitdiff
path: root/lib/libc/yp
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-10-25 12:48:23 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-10-25 12:48:23 +0000
commit718e5a18540c01b4cec8df60557e7f8278c01f07 (patch)
tree5d02a8c9d7ae547da6b2192029c6ae8ad6caa155 /lib/libc/yp
parentf04f5dc4bd2db4c03c23e1c90e2185a92820dce4 (diff)
fix accidental free() of unallocated object
Diffstat (limited to 'lib/libc/yp')
-rw-r--r--lib/libc/yp/yplib.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libc/yp/yplib.c b/lib/libc/yp/yplib.c
index 0c1a59b609c..855b6398d93 100644
--- a/lib/libc/yp/yplib.c
+++ b/lib/libc/yp/yplib.c
@@ -408,7 +408,7 @@ yp_match(indomain, inmap, inkey, inkeylen, outval, outvallen)
struct ypresp_val yprv;
struct timeval tv;
struct ypreq_key yprk;
- int r = 0;
+ int r;
*outval = NULL;
*outvallen = 0;
@@ -422,12 +422,13 @@ again:
inkeylen, &yprv.valdat.dptr, &yprv.valdat.dsize)) {
*outvallen = yprv.valdat.dsize;
if ((*outval = malloc(*outvallen + 1)) == NULL) {
- r = YPERR_YPERR;
- goto out;
+ _yp_unbind(ysd);
+ return YPERR_YPERR;
}
(void)memcpy(*outval, yprv.valdat.dptr, *outvallen);
(*outval)[*outvallen] = '\0';
- goto out;
+ _yp_unbind(ysd);
+ return 0;
}
#endif