fsck.c: Fix NULL-pointer dereference.
authorAndre Noll <maan@systemlinux.org>
Sat, 22 Dec 2007 12:58:01 +0000 (13:58 +0100)
committerAndre Noll <maan@systemlinux.org>
Sat, 22 Dec 2007 12:58:01 +0000 (13:58 +0100)
fsck_cleanup() might be called with t == NULL.

fsck.c

diff --git a/fsck.c b/fsck.c
index bbacdf2..6d5078c 100644 (file)
--- a/fsck.c
+++ b/fsck.c
@@ -621,6 +621,9 @@ out:
 static void fsck_cleanup(struct osl_table *t)
 {
        int i;
+
+       if (!t)
+               return;
        if (t->desc->column_descriptions) {
                struct osl_column_description *cd;
                for (i = 0; i < t->desc->num_columns; i++) {
@@ -629,10 +632,8 @@ static void fsck_cleanup(struct osl_table *t)
                }
                free(t->desc->column_descriptions);
        }
-       if (t) {
-               free(t->columns);
-               free(t);
-       }
+       free(t->columns);
+       free(t);
 
 }