aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/modprobe.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-10-20 19:56:05 -0500
committerRob Landley <rob@landley.net>2014-10-20 19:56:05 -0500
commit21f3c8db00f0d4a3f0989559847d2564f4c73a11 (patch)
tree50d7f1092d749394c66fe0f69bc742b8be4aecd5 /toys/pending/modprobe.c
parent977e48e1626b3e3f1f1f9b14f05ffc11e252455f (diff)
downloadtoybox-21f3c8db00f0d4a3f0989559847d2564f4c73a11.tar.gz
More static analysis fixes from Ashwini Sharma.
Diffstat (limited to 'toys/pending/modprobe.c')
-rw-r--r--toys/pending/modprobe.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/toys/pending/modprobe.c b/toys/pending/modprobe.c
index cbf929b9..5431cb35 100644
--- a/toys/pending/modprobe.c
+++ b/toys/pending/modprobe.c
@@ -178,15 +178,21 @@ static int read_line(FILE *fl, char **li)
line = NULL;
linelen = nxtlinelen = 0;
len = getline(&line, (size_t*)&linelen, fl);
- if (len <= 0) return len;
+ if (len <= 0) {
+ free(line);
+ return len;
+ }
// checking for commented lines.
if (line[0] != '#') break;
free(line);
}
for (;;) {
if (line[len - 1] == '\n') len--;
- // checking line continuation.
- if (!len || line[len - 1] != '\\') break;
+ if (!len) {
+ free(line);
+ return len;
+ } else if (line[len - 1] != '\\') break;
+
len--;
nxtlen = getline(&nxtline, (size_t*)&nxtlinelen, fl);
if (nxtlen <= 0) break;