aboutsummaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorTong Ho <tong.ho@xilinx.com>2020-01-09 12:09:58 -0800
committerDaniel P. Berrangé <berrange@redhat.com>2020-05-07 12:48:41 +0100
commit569644f761f704901b70bd259762c60b7cb28634 (patch)
treef6a9e2477fccb6d376e2e571d0be142e5326fe44 /crypto
parent609dd53df540edd72faee705205aceca9c42fea5 (diff)
crypto: fix getter of a QCryptoSecret's property
This fixes the condition-check done by the "loaded" property getter, such that the property returns true even when the secret is loaded by the 'file' option. Signed-off-by: Tong Ho <tong.ho@xilinx.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/secret.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/secret.c b/crypto/secret.c
index 1cf0ad0ce8..5fb6bbe59c 100644
--- a/crypto/secret.c
+++ b/crypto/secret.c
@@ -221,6 +221,7 @@ qcrypto_secret_prop_set_loaded(Object *obj,
secret->rawlen = inputlen;
} else {
g_free(secret->rawdata);
+ secret->rawdata = NULL;
secret->rawlen = 0;
}
}
@@ -231,7 +232,7 @@ qcrypto_secret_prop_get_loaded(Object *obj,
Error **errp G_GNUC_UNUSED)
{
QCryptoSecret *secret = QCRYPTO_SECRET(obj);
- return secret->data != NULL;
+ return secret->rawdata != NULL;
}