]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
pylibmount: make tab parsers more robust [coverity scan]
authorKarel Zak <kzak@redhat.com>
Tue, 1 Oct 2013 15:15:08 +0000 (17:15 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 1 Oct 2013 15:15:08 +0000 (17:15 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/python/context.c

index ce7711b3f2692e71e378ca8258a3ad2a1ca13f50..408c8bd7593e3baa24b07133ebafbf832727bbbf 100644 (file)
@@ -854,8 +854,7 @@ static PyObject *Context_get_fstab(ContextObjext *self)
 {
        struct libmnt_table *tab = NULL;
 
-       mnt_context_get_fstab(self->cxt, &tab);
-       if (!tab)
+       if (mnt_context_get_fstab(self->cxt, &tab) != 0 || !tab)
                return NULL;
        return PyObjectResultTab(tab);
 }
@@ -864,7 +863,8 @@ static PyObject *Context_get_mtab(ContextObjext *self)
 {
        struct libmnt_table *tab = NULL;
 
-       mnt_context_get_mtab(self->cxt, &tab);
+       if (mnt_context_get_mtab(self->cxt, &tab) != 0 || !tab)
+               return NULL;
        return PyObjectResultTab(tab);
 }