cpukit/jffs2: Avoid possible null deref

This was added with the writebuffer work and should have been protected
by the error check.
This commit is contained in:
Kinsey Moore
2023-03-22 16:17:08 -05:00
committed by Joel Sherrill
parent 7163014e3f
commit acf4eb271c

View File

@@ -1365,11 +1365,11 @@ int rtems_jffs2_initialize(
err = -ENOMEM;
}
sb = &fs_info->sb;
c = JFFS2_SB_INFO(sb);
c->mtd = NULL;
if (err == 0) {
sb = &fs_info->sb;
c = JFFS2_SB_INFO(sb);
c->mtd = NULL;
rtems_recursive_mutex_init(&sb->s_mutex, RTEMS_FILESYSTEM_TYPE_JFFS2);
}