From: Luka Perkov Date: Tue, 9 Jul 2013 23:50:48 +0000 (+0200) Subject: close file pointer before exiting function X-Git-Url: http://git.openwrt.org/?p=project%2Fubox.git;a=commitdiff_plain;h=a9cb25c5c2b9d864f77033533fab9f2f8a6f94ab close file pointer before exiting function Signed-off-by: Luka Perkov --- diff --git a/block.c b/block.c index c9285d6..2289b77 100644 --- a/block.c +++ b/block.c @@ -545,8 +545,10 @@ static char* find_mount_point(char *block) char *p = &line[len + 1]; char *t = strstr(p, " "); - if (!t) + if (!t) { + fclose(fp); return NULL; + } *t = '\0'; point = p; break; diff --git a/mount_root.c b/mount_root.c index ede5718..8868e40 100644 --- a/mount_root.c +++ b/mount_root.c @@ -109,12 +109,16 @@ static char* find_mount(char *mp) while (fgets(line, sizeof(line), fp)) { char *s, *t = strstr(line, " "); - if (!t) + if (!t) { + fclose(fp); return NULL; + } t++; s = strstr(t, " "); - if (!s) + if (!s) { + fclose(fp); return NULL; + } *s = '\0'; if (!strcmp(t, mp)) { @@ -143,13 +147,16 @@ static char* find_mount_point(char *block, char *fs) char *p = &line[len + 1]; char *t = strstr(p, " "); - if (!t) + if (!t) { + fclose(fp); return NULL; + } *t = '\0'; t++; if (fs && strncmp(t, fs, strlen(fs))) { + fclose(fp); ERROR("block is mounted with wrong fs\n"); return NULL; }