Skip to content

Commit

Permalink
crypto: fix getter of a QCryptoSecret's property
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tong Ho authored and berrange committed May 7, 2020
1 parent 609dd53 commit 569644f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crypto/secret.c
Expand Up @@ -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;
}
}
Expand All @@ -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;
}


Expand Down

0 comments on commit 569644f

Please sign in to comment.