From 13e38773230e33fe00a1a36d8da1e8e3775c5b3c Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 1 Dec 2023 13:45:29 -0500 Subject: [PATCH] Use correct strdup function in macro Coverity disovered a mismatch between the function we used to allocated the strings and the function used to free them. In practice this is not a problem on most systems, but there are those wehre free() and OPENSSL_free() may actually differ. Fixes: CID 469502: Incorrect deallocator used (ALLOC_FREE_MISMATCH) CID 469503: Incorrect deallocator used (ALLOC_FREE_MISMATCH) Signed-off-by: Simo Sorce --- src/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.c b/src/util.c index c1f12769..59f52796 100644 --- a/src/util.c +++ b/src/util.c @@ -322,7 +322,7 @@ static int get_pin_file(P11PROV_CTX *ctx, const char *str, size_t len, #define COPY_STRUCT_MEMBER(dst, src, _name) \ if ((src)->_name) { \ - (dst)->_name = strdup((src)->_name); \ + (dst)->_name = OPENSSL_strdup((src)->_name); \ if (!(dst)->_name) { \ p11prov_uri_free((dst)); \ return NULL; \