tests/qtest/tpm: Remove redundant check in the tpm_test_swtpm_test()
authorAlexChen <alex.chen@huawei.com>
Thu, 5 Nov 2020 15:03:36 +0000 (23:03 +0800)
committerThomas Huth <thuth@redhat.com>
Mon, 9 Nov 2020 17:34:21 +0000 (18:34 +0100)
The 'addr' would not be NULL after checking 'succ' is valid,
and it has been dereferenced in the previous code(args = g_strdup_printf()).
So the check on 'addr' in the tpm_test_swtpm_test() is redundant. Remove it.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
Message-Id: <5FA41448.4040404@huawei.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/qtest/tpm-tests.c

index 70c80f8379afa002dd4ad3d8030de93f1fdb2a89..0da3a8a4df530cae18c25ff4e45ad3b146c5d358 100644 (file)
@@ -70,10 +70,8 @@ void tpm_test_swtpm_test(const char *src_tpm_path, tx_func *tx,
     qtest_end();
     tpm_util_swtpm_kill(swtpm_pid);
 
-    if (addr) {
-        g_unlink(addr->u.q_unix.path);
-        qapi_free_SocketAddress(addr);
-    }
+    g_unlink(addr->u.q_unix.path);
+    qapi_free_SocketAddress(addr);
 }
 
 void tpm_test_swtpm_migration_test(const char *src_tpm_path,