From 83a6d36d4226f82c202ffb27f89e080f95b71c30 Mon Sep 17 00:00:00 2001 From: Hong-Mei Li Date: Mon, 1 Apr 2013 11:22:50 +0800 Subject: [PATCH] libsparse: Fix null pointer issue Fix the issue that "out" pointer is dereferenced without checking. Change-Id: I76a57ad7309841218231346f4807ef2be8628737 Signed-off-by: Hong-Mei Li --- libsparse/output_file.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libsparse/output_file.c b/libsparse/output_file.c index b5ae4191f..5014e4a87 100644 --- a/libsparse/output_file.c +++ b/libsparse/output_file.c @@ -675,6 +675,9 @@ struct output_file *output_file_open_fd(int fd, unsigned int block_size, int64_t } else { out = output_file_new_normal(); } + if (!out) { + return NULL; + } out->ops->open(out, fd);