Spotted by coverity: Dereferencing a null pointer "sdp->md.journal".

Signed-off-by: Andrew Price <[email protected]>
---
 gfs2/convert/gfs2_convert.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 9b54670..9944d23 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -1918,6 +1918,9 @@ static int conv_build_jindex(struct gfs2_sbd *sdp)
 
        sdp->md.journal = malloc(sdp->md.journals *
                                 sizeof(struct gfs2_inode *));
+       if (sdp->md.journal == NULL) {
+               return errno;
+       }
        for (j = 0; j < sdp->md.journals; j++) {
                char name[256];
 
-- 
1.7.6.5

Reply via email to