From: Milan Broz Date: Tue, 22 May 2012 12:54:52 +0000 (+0200) Subject: Fix clang compile warnings (error path). X-Git-Tag: upstream/1.6~277^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ed1ab3e49801ccda36d9a855394a02c4b9b0a542;p=platform%2Fupstream%2Fcryptsetup.git Fix clang compile warnings (error path). --- diff --git a/lib/setup.c b/lib/setup.c index 104684a..f34733d 100644 --- a/lib/setup.c +++ b/lib/setup.c @@ -587,7 +587,7 @@ int crypt_set_data_device(struct crypt_device *cd, const char *device) } /* metadata device must be set */ - if (!cd->device) + if (!cd->device || !device) return -EINVAL; r = device_ready(NULL, device, O_RDONLY); @@ -704,7 +704,7 @@ int crypt_init_by_name_and_header(struct crypt_device **cd, } if (isPLAIN((*cd)->type)) { - (*cd)->plain_uuid = strdup(dmd.uuid); + (*cd)->plain_uuid = dmd.uuid ? strdup(dmd.uuid) : NULL; (*cd)->plain_hdr.hash = NULL; /* no way to get this */ (*cd)->plain_hdr.offset = dmd.offset; (*cd)->plain_hdr.skip = dmd.iv_offset; @@ -716,7 +716,7 @@ int crypt_init_by_name_and_header(struct crypt_device **cd, (*cd)->plain_cipher_mode = strdup(cipher_mode); } } else if (isLOOPAES((*cd)->type)) { - (*cd)->loopaes_uuid = strdup(dmd.uuid); + (*cd)->loopaes_uuid = dmd.uuid ? strdup(dmd.uuid) : NULL; (*cd)->loopaes_hdr.offset = dmd.offset; r = crypt_parse_name_and_mode(dmd.cipher, cipher,