From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47037) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDDNi-0005kQ-6l for qemu-devel@nongnu.org; Thu, 09 Jul 2015 11:04:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZDDNg-0006ZF-Tn for qemu-devel@nongnu.org; Thu, 09 Jul 2015 11:04:57 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:39880) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDDNg-0006ZB-Nl for qemu-devel@nongnu.org; Thu, 09 Jul 2015 11:04:56 -0400 Date: Thu, 9 Jul 2015 17:04:54 +0200 From: Aurelien Jarno Message-ID: <20150709150454.GH11361@aurel32.net> References: <1436453830-4700-1-git-send-email-pbonzini@redhat.com> <1436453830-4700-3-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1436453830-4700-3-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PULL 2/2] crypto: fix builtin qcrypto_cipher_free List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On 2015-07-09 16:57, Paolo Bonzini wrote: > This was dereferencing a pointer before checking if it was NULL. > > Reported-by: Christian Borntraeger > Reported-by: Aurelien Jarno > Signed-off-by: Paolo Bonzini > --- > crypto/cipher-builtin.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > 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); > } Thanks for the quick fix. Reviewed-by: Aurelien Jarno Tested-by: Aurelien Jarno -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurelien@aurel32.net http://www.aurel32.net