diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2015-07-09 16:52:48 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2015-07-09 16:53:45 +0200 |
commit | 4f4f6976d80614e2d81cea4385885876f24bb257 (patch) | |
tree | a6f64e5e077d942def7e365d3a323a2e09afc967 /crypto | |
parent | d09a6fde1590ca3a45b608b6873a680f208dfeb5 (diff) | |
download | qemu-4f4f6976d80614e2d81cea4385885876f24bb257.zip qemu-4f4f6976d80614e2d81cea4385885876f24bb257.tar.gz qemu-4f4f6976d80614e2d81cea4385885876f24bb257.tar.bz2 |
crypto: fix builtin qcrypto_cipher_free
This was dereferencing a pointer before checking if it was NULL.
Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reported-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/cipher-builtin.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/cipher-builtin.c b/crypto/cipher-builtin.c index c625cb4..912c1b9 100644 --- a/crypto/cipher-builtin.c +++ b/crypto/cipher-builtin.c @@ -354,11 +354,13 @@ QCryptoCipher *qcrypto_cipher_new(QCryptoCipherAlgorithm alg, void qcrypto_cipher_free(QCryptoCipher *cipher) { - QCryptoCipherBuiltin *ctxt = cipher->opaque; + QCryptoCipherBuiltin *ctxt; + if (!cipher) { return; } + ctxt = cipher->opaque; ctxt->free(cipher); g_free(cipher); } |