From 90ba925a192c81a5a270959622158e1acaa9f52a Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 20 Dec 2010 14:20:52 +0000 Subject: [PATCH] Add internal error if pointer is uninitialized Add simple check for existance of 'pl' and printer internal error message if device is missing instead of plain crash. --- lib/format_pool/disk_rep.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/format_pool/disk_rep.c b/lib/format_pool/disk_rep.c index 2c16f50ea..ca8bfd736 100644 --- a/lib/format_pool/disk_rep.c +++ b/lib/format_pool/disk_rep.c @@ -263,6 +263,11 @@ static int _read_vg_pds(const struct format_type *fmt, struct dm_pool *mem, */ if (!sp_count) { /* FIXME pl left uninitialised if !info->dev */ + if (!pl) { + log_error(INTERNAL_ERROR "device is missing"); + dm_pool_destroy(tmpmem); + return 0; + } sp_count = pl->pd.pl_subpools; if (!(sp_devs = dm_pool_zalloc(tmpmem, -- 2.43.5