From: Roy Marples Date: Sat, 6 Mar 2010 17:16:20 +0000 (+0000) Subject: Close the fp. X-Git-Tag: v5.2.2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ee7e6c0a375c8240c5c8a686c77a27fcf2df6a4;p=thirdparty%2Fdhcpcd.git Close the fp. --- diff --git a/platform-linux.c b/platform-linux.c index 99cb4a35..79562c84 100644 --- a/platform-linux.c +++ b/platform-linux.c @@ -85,17 +85,20 @@ hardware_platform(void) if (fp == NULL) return NULL; + p = NULL; while ((buf = get_line(fp))) { if (strncmp(buf, mproc, strlen(mproc)) == 0) { p = strchr(buf, ':'); if (p != NULL && ++p != NULL) { while (*p == ' ') p++; - return p; + break; } } } + fclose(fp); - errno = ESRCH; - return NULL; + if (p == NULL) + errno = ESRCH; + return p; }