Skip to content

Commit

Permalink
Use correct strdup function in macro
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
simo5 committed Dec 1, 2023
1 parent 9855e8e commit 13e3877
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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; \
Expand Down

0 comments on commit 13e3877

Please sign in to comment.