]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Close the fp.
authorRoy Marples <roy@marples.name>
Sat, 6 Mar 2010 17:16:20 +0000 (17:16 +0000)
committerRoy Marples <roy@marples.name>
Sat, 6 Mar 2010 17:16:20 +0000 (17:16 +0000)
platform-linux.c

index 99cb4a35ab9ac09a5566774b3676900455ce8553..79562c8445554f239dbe5a84f5a91a64f1a1e286 100644 (file)
@@ -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;
 }