[lvm-devel] master - cleanup: do not return stack content

Zdenek Kabelac zkabelac at fedoraproject.org
Mon Jul 22 10:42:18 UTC 2013


Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=dedec81d7b939650f390c0be5a23632b39d83012
Commit:        dedec81d7b939650f390c0be5a23632b39d83012
Parent:        aed4e9c703a81aec0a56dc7134ff336683ab5c1a
Author:        Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate:    Fri Jul 19 17:29:37 2013 +0200
Committer:     Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Mon Jul 22 12:41:21 2013 +0200

cleanup: do not return stack content

Return initialized struct in error path.
---
 liblvm/lvm_lv.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/liblvm/lvm_lv.c b/liblvm/lvm_lv.c
index f416195..7fc2392 100644
--- a/liblvm/lvm_lv.c
+++ b/liblvm/lvm_lv.c
@@ -593,15 +593,16 @@ struct lvm_property_value lvm_lv_params_get_property(
 						const lv_create_params_t params,
 						const char *name)
 {
-	struct lvm_property_value rc;
-
-	rc.is_valid = 0;
+	struct lvm_property_value rc = {
+		.is_valid = 0
+	};
 
 	if (params && params->magic == LV_CREATE_PARAMS_MAGIC) {
 		rc = get_property(NULL, NULL, NULL, NULL, NULL, &params->lvp, name);
 	} else {
 		log_error("Invalid lv_create_params parameter");
 	}
+
 	return rc;
 }
 




More information about the lvm-devel mailing list