[PATCH] Fix potential NULL pointer deref in gen_init_cpio

Fix potential NULL pointer deref in gen_init_cpio.c spotted by coverity
checker.  This fixes coverity bug #86

Without this patch we risk dereferencing a NULL `type' in the
"if ('\n' == *type) {" line.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Jesper Juhl 2006-04-18 22:21:54 -07:00 коммит произвёл Linus Torvalds
Родитель 9dfb563b07
Коммит aa1e816fc9
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -471,6 +471,7 @@ int main (int argc, char *argv[])
"ERROR: incorrect format, could not locate file type line %d: '%s'\n", "ERROR: incorrect format, could not locate file type line %d: '%s'\n",
line_nr, line); line_nr, line);
ec = -1; ec = -1;
break;
} }
if ('\n' == *type) { if ('\n' == *type) {
@ -506,6 +507,7 @@ int main (int argc, char *argv[])
line_nr, line); line_nr, line);
} }
} }
if (ec == 0)
cpio_trailer(); cpio_trailer();
exit(ec); exit(ec);