Commit 4f4f6976 authored by Paolo Bonzini's avatar Paolo Bonzini
Browse files

crypto: fix builtin qcrypto_cipher_free



This was dereferencing a pointer before checking if it was NULL.

Reported-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Reported-by: default avatarAurelien Jarno <aurelien@aurel32.net>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent d09a6fde
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);
}