From: brian Date: Mon, 3 Apr 2000 19:56:35 +0000 (+0000) Subject: Plug two file descriptor leaks X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=65d091c45a69679f4dece78fff8d12df6b20e4d3;p=openbsd Plug two file descriptor leaks --- diff --git a/usr.sbin/ppp/ppp/systems.c b/usr.sbin/ppp/ppp/systems.c index a4a08badb76..6d6df47320e 100644 --- a/usr.sbin/ppp/ppp/systems.c +++ b/usr.sbin/ppp/ppp/systems.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $OpenBSD: systems.c,v 1.13 2000/03/28 15:13:09 brian Exp $ + * $OpenBSD: systems.c,v 1.14 2000/04/03 19:56:35 brian Exp $ * * TODO: */ @@ -349,8 +349,10 @@ ReadSystem(struct bundle *bundle, const char *name, const char *file, log_Printf(LogCOMMAND, "%s: Including \"%s\"\n", filename, arg); n = ReadSystem(bundle, name, arg, prompt, cx, how); log_Printf(LogCOMMAND, "%s: Done include of \"%s\"\n", filename, arg); - if (!n) + if (!n) { + fclose(fp); return 0; /* got it */ + } break; default: log_Printf(LogWARN, "%s: %s: Invalid command\n", filename, cp); @@ -364,8 +366,10 @@ ReadSystem(struct bundle *bundle, const char *name, const char *file, if (strcmp(cp, name) == 0) { /* We're in business */ - if (how == SYSTEM_EXISTS) + if (how == SYSTEM_EXISTS) { + fclose(fp); return 0; + } while ((n = xgets(line, sizeof line, fp))) { linenum += n; indent = issep(*line);