From 70520b51b9086b1fd1f7824e5bee5d721131c3c1 Mon Sep 17 00:00:00 2001 From: Mike Pritchard Date: Mon, 29 Jan 1996 20:16:30 +0000 Subject: [PATCH] Getpwent() and getservent() can wind up calling free() with an invalid pointer if a call to yp_first() fails. Closes PR # 964, and possibly # 952. --- lib/libc/gen/getpwent.c | 1 - lib/libc/net/getservent.c | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c index a3e32add696f..70a2c981f021 100644 --- a/lib/libc/gen/getpwent.c +++ b/lib/libc/gen/getpwent.c @@ -650,7 +650,6 @@ _havemaster(char *_pw_yp_domain) if (yp_first(_pw_yp_domain, "master.passwd.byname", &key, &keylen, &result, &resultlen)) { - free(result); return 0; } free(result); diff --git a/lib/libc/net/getservent.c b/lib/libc/net/getservent.c index 9fb47b61a616..35e535a39467 100644 --- a/lib/libc/net/getservent.c +++ b/lib/libc/net/getservent.c @@ -78,7 +78,6 @@ _getypservent(line) free(key); if ((rv = yp_first(yp_domain, "services.byname", &key, &keylen, &result, &resultlen))) { - free(result); serv_stepping_yp = 0; return(0); }