diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-25 12:48:23 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-25 12:48:23 +0000 |
commit | 718e5a18540c01b4cec8df60557e7f8278c01f07 (patch) | |
tree | 5d02a8c9d7ae547da6b2192029c6ae8ad6caa155 | |
parent | f04f5dc4bd2db4c03c23e1c90e2185a92820dce4 (diff) |
fix accidental free() of unallocated object
-rw-r--r-- | lib/libc/yp/yplib.c | 9 |
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 |