summary refs log tree commit diff stats
path: root/tests/test-crypto-cipher.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-06-30 11:03:30 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-07-02 06:25:28 +0200
commit7b8eb7f848fdd808dbd01f6aa7ae42fd8c64e4b4 (patch)
tree8509cd5889e30feca6a3ad26ea1735e7e4b108e6 /tests/test-crypto-cipher.c
parentd8da9e71b6c79c2899c08bb168cd0ae88da70596 (diff)
downloadfocaccia-qemu-7b8eb7f848fdd808dbd01f6aa7ae42fd8c64e4b4.tar.gz
focaccia-qemu-7b8eb7f848fdd808dbd01f6aa7ae42fd8c64e4b4.zip
tests: Use error_free_or_abort() where appropriate
Replace

    g_assert(err != NULL);
    error_free(err);
    err = NULL;

and variations thereof by

    error_free_or_abort(&err);

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200630090351.1247703-6-armbru@redhat.com>
Diffstat (limited to 'tests/test-crypto-cipher.c')
-rw-r--r--tests/test-crypto-cipher.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/tests/test-crypto-cipher.c b/tests/test-crypto-cipher.c
index 07fa2fa616..bebba1a4f4 100644
--- a/tests/test-crypto-cipher.c
+++ b/tests/test-crypto-cipher.c
@@ -761,10 +761,7 @@ static void test_cipher_short_plaintext(void)
                                  sizeof(plaintext1),
                                  &err);
     g_assert(ret == -1);
-    g_assert(err != NULL);
-
-    error_free(err);
-    err = NULL;
+    error_free_or_abort(&err);
 
     /* Should report an error as plaintext is larger than
      * block size, but not a multiple of block size
@@ -775,9 +772,8 @@ static void test_cipher_short_plaintext(void)
                                  sizeof(plaintext2),
                                  &err);
     g_assert(ret == -1);
-    g_assert(err != NULL);
+    error_free_or_abort(&err);
 
-    error_free(err);
     qcrypto_cipher_free(cipher);
 }