]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
test: fix coverity 1451553: resource leak
authorPauli <ppzgs1@gmail.com>
Thu, 18 Mar 2021 00:26:22 +0000 (10:26 +1000)
committerPauli <ppzgs1@gmail.com>
Sat, 20 Mar 2021 00:07:59 +0000 (10:07 +1000)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14596)

test/params_api_test.c

index c1dbdad1292ff0974b13137c4437dabb500ae796..e47c2643ad437b2084adb4e666794be724e983b3 100644 (file)
@@ -540,8 +540,10 @@ static int test_param_construct(void)
         || !TEST_true(OSSL_PARAM_set_utf8_string(cp, "abcdef"))
         || !TEST_size_t_eq(cp->return_size, sizeof("abcdef") - 1)
         || !TEST_true(OSSL_PARAM_get_utf8_string(cp, &bufp, 0))
-        || !TEST_str_eq(bufp, "abcdef"))
+        || !TEST_str_eq(bufp, "abcdef")) {
+        OPENSSL_free(bufp);
         goto err;
+    }
     OPENSSL_free(bufp);
     bufp = buf2;
     if (!TEST_true(OSSL_PARAM_get_utf8_string(cp, &bufp, sizeof(buf2)))