From: Brian Behlendorf Date: Thu, 31 May 2007 15:42:48 +0000 (-0400) Subject: [COVERITY] Free potential null dereference bug in e2fsck X-Git-Tag: E2FSPROGS-1_40~26 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=8f234d9650eb6f6a897148d5136cb27f373de4a7;p=tools%2Fe2fsprogs.git [COVERITY] Free potential null dereference bug in e2fsck At the second conditional iter->file could still be NULL. We need to check for it again. Should never happen in practice, but better to be sure. Coverity ID: 6: Forward Null Signed-off-by: Brian Behlendorf Signed-off-by: "Theodore Ts'o" --- diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index bbd23ad..e6b0fdf 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,8 @@ +2007-05-31 Theodore Tso + + * profile.c (profile_node_iterator): Avoid potential null + dereference bug. + 2007-05-22 Theodore Tso * message.c (expand_inode_expression, expand_percent_expression): diff --git a/e2fsck/profile.c b/e2fsck/profile.c index 5752343..d46833c 100644 --- a/e2fsck/profile.c +++ b/e2fsck/profile.c @@ -1265,7 +1265,8 @@ errcode_t profile_node_iterator(void **iter_p, struct profile_node **ret_node, * If the file has changed, then the node pointer is invalid, * so we'll have search the file again looking for it. */ - if (iter->node && (iter->file->upd_serial != iter->file_serial)) { + if (iter->node && (iter->file && + iter->file->upd_serial != iter->file_serial)) { iter->flags &= ~PROFILE_ITER_FINAL_SEEN; skip_num = iter->num; iter->node = 0; @@ -1349,8 +1350,6 @@ get_new_file: iter->num++; if (!p) { iter->file = iter->file->next; - if (iter->file) { - } iter->node = 0; skip_num = 0; goto get_new_file;