libsparse: Fix null pointer issue

Fix the issue that "out" pointer is dereferenced without checking.

Change-Id: I76a57ad7309841218231346f4807ef2be8628737
Signed-off-by: Hong-Mei Li <a21834@motorola.com>
This commit is contained in:
Hong-Mei Li 2013-04-01 11:22:50 +08:00
parent f5562cb66c
commit 83a6d36d42
1 changed files with 3 additions and 0 deletions

View File

@ -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);