<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>

<style data-premailer="ignore" type="text/css">
a { color: #1068bf; }
</style>


<style>img {
max-width: 100%; height: auto;
}
body {
font-size: 0.875rem;
}
body {
-webkit-text-shadow: rgba(255,255,255,0.01) 0 0 1px;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, "Helvetica Neue", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: inherit;
}
</style>
</head>
<body style='font-size: inherit; -webkit-text-shadow: rgba(255,255,255,0.01) 0 0 1px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, "Helvetica Neue", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";'>
<div class="content">

<table border="0" cellpadding="0" cellspacing="0" style="width: 100%; border-collapse: separate; border-spacing: 0; margin: 0 auto;">
<tbody>
<tr>
<td style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; overflow: hidden;" align="left" bgcolor="#ffffff">
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%; border-collapse: separate; border-spacing: 0;">
<tbody>
<tr>
<td style="color: #333333; border-bottom-width: 1px; border-bottom-color: #ededed; border-bottom-style: solid; font-weight: bold; line-height: 1.4; padding: 20px 0;">
Merge request <a href="https://gitlab.com/gnutls/gnutls/-/merge_requests/1652">!1652</a> was reviewed by <a href="https://gitlab.com/thesamesam">Sam James</a>
</td>
</tr>
<tr>
<td style="overflow: hidden; line-height: 1.4; display: grid;">
<p style="color: #777777;">
<a href="https://gitlab.com/thesamesam">Sam James</a>
commented on a
discussion on <a href="https://gitlab.com/gnutls/gnutls/-/merge_requests/1652#note_1137210016">lib/pkcs11_privkey.c</a>:
</p>
<table class="code gl-mb-5" style="border-spacing: 0; margin-bottom: 1rem; border-collapse: collapse; width: auto; font-family: monospace; font-size: 90%;" bgcolor="#fff" width="100%" cellpadding="0" cellspacing="0">
<tr class="line_holder" style="line-height: 1.6;">
<td class="old_line diff-line-num" data-linenumber="89" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: inherit;" align="right" bgcolor="#fafafa">
89
</td>
<td class="new_line diff-line-num" data-linenumber="90" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: inherit;" align="right" bgcolor="#fafafa">
90
</td>
<td class="line_content" style="padding: inherit;"><pre style='display: block; font-size: 0.8125rem; color: #303030; position: relative; font-family: "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; word-break: break-all; word-wrap: break-word; background-color: inherit; border-radius: 2px; margin: 0; padding: 0; border: inherit solid #dbdbdb;'> <span id="LC90" class="line" lang="c">     <span class="p">(</span><span class="o" style="font-weight: 600;">*</span><span class="n" style="color: #333;">key</span><span class="p">)</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333;">uinfo</span> <span class="o" style="font-weight: 600;">=</span> <span class="n" style="color: #333;">p11_kit_uri_new</span><span class="p">();</span></span>
</pre></td>
</tr>
<tr class="line_holder" style="line-height: 1.6;">
<td class="old_line diff-line-num" data-linenumber="90" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: inherit;" align="right" bgcolor="#fafafa">
90
</td>
<td class="new_line diff-line-num" data-linenumber="91" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: inherit;" align="right" bgcolor="#fafafa">
91
</td>
<td class="line_content" style="padding: inherit;"><pre style='display: block; font-size: 0.8125rem; color: #303030; position: relative; font-family: "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; word-break: break-all; word-wrap: break-word; background-color: inherit; border-radius: 2px; margin: 0; padding: 0; border: inherit solid #dbdbdb;'> <span id="LC91" class="line" lang="c">     <span class="k" style="font-weight: 600;">if</span> <span class="p">((</span><span class="o" style="font-weight: 600;">*</span><span class="n" style="color: #333;">key</span><span class="p">)</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333;">uinfo</span> <span class="o" style="font-weight: 600;">==</span> <span class="nb" style="color: #0086b3;">NULL</span><span class="p">)</span> <span class="p">{</span></span>
</pre></td>
</tr>
<tr class="line_holder" style="line-height: 1.6;">
<td class="old_line diff-line-num" data-linenumber="91" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: inherit;" align="right" bgcolor="#fafafa">
91
</td>
<td class="new_line diff-line-num" data-linenumber="92" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: inherit;" align="right" bgcolor="#fafafa">
92
</td>
<td class="line_content" style="padding: inherit;"><pre style='display: block; font-size: 0.8125rem; color: #303030; position: relative; font-family: "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; word-break: break-all; word-wrap: break-word; background-color: inherit; border-radius: 2px; margin: 0; padding: 0; border: inherit solid #dbdbdb;'> <span id="LC92" class="line" lang="c">             <span class="n" style="color: #333;">free</span><span class="p">(</span><span class="o" style="font-weight: 600;">*</span><span class="n" style="color: #333;">key</span><span class="p">);</span></span>
</pre></td>
</tr>

</table>
<div class="md" style="border-bottom-width: 1px; border-bottom-color: #ededed; border-bottom-style: solid; padding-bottom: 1em; color: #303030; word-wrap: break-word;">
<p dir="auto" style="color: #303030; margin: 0 0 16px;" align="initial">There's almost a way, but it doesn't seem to work for gnutls' setup:</p>
<div class="gl-relative markdown-code-block js-markdown-code">
<pre class="code highlight js-syntax-highlight language-plaintext" lang="plaintext" data-canonical-lang="" v-pre="true" style="display: block; font-size: 13px; color: #303030; line-height: 1.6em; overflow-x: auto; border-radius: 4px; position: relative; font-family: monospace; word-break: break-all; word-wrap: break-word; background-color: #fff; -premailer-cellpadding: 0; -premailer-cellspacing: 0; -premailer-width: 100%; margin: 0 0 16px; padding: 12px; border: 1px solid #dbdbdb;"><code style='font-size: inherit; color: inherit; word-wrap: normal; word-break: keep-all; background-color: inherit; border-radius: 4px; white-space: pre; margin-top: 0; font-family: "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; overflow-wrap: normal; padding: unset;'><span id="LC1" class="line" lang="plaintext" style="margin-top: 0;">./../includes/gnutls/gnutls.h:2346:1: warning: 'malloc' attribute ignored; valid only for functions [-Wattributes]</span>
<span id="LC2" class="line" lang="plaintext"> 2346 | extern _SYM_EXPORT gnutls_alloc_function gnutls_malloc;</span>
<span id="LC3" class="line" lang="plaintext">      | ^~~~~~</span></code></pre>
<copy-code></copy-code>
</div>
<p dir="auto" style="color: #303030; margin: 0 0 16px;" align="initial">Rough diff without autotools wiring up for checking support in compiler:</p>
<div class="gl-relative markdown-code-block js-markdown-code">
<pre class="code highlight js-syntax-highlight language-plaintext" lang="plaintext" data-canonical-lang="" v-pre="true" style="display: block; font-size: 13px; color: #303030; line-height: 1.6em; overflow-x: auto; border-radius: 4px; position: relative; font-family: monospace; word-break: break-all; word-wrap: break-word; background-color: #fff; -premailer-cellpadding: 0; -premailer-cellspacing: 0; -premailer-width: 100%; margin: 0 0 16px; padding: 12px; border: 1px solid #dbdbdb;"><code style='font-size: inherit; color: inherit; word-wrap: normal; word-break: keep-all; background-color: inherit; border-radius: 4px; white-space: pre; margin-top: 0; font-family: "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; overflow-wrap: normal; padding: unset;'><span id="LC1" class="line" lang="plaintext" style="margin-top: 0;">diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in</span>
<span id="LC2" class="line" lang="plaintext">index 9b700e03f..f47e6cac4 100644</span>
<span id="LC3" class="line" lang="plaintext">--- a/lib/includes/gnutls/gnutls.h.in</span>
<span id="LC4" class="line" lang="plaintext">+++ b/lib/includes/gnutls/gnutls.h.in</span>
<span id="LC5" class="line" lang="plaintext">@@ -2341,10 +2341,13 @@ typedef void *(*gnutls_realloc_function) (void *, size_t);</span>
<span id="LC6" class="line" lang="plaintext"> void gnutls_global_set_time_function(gnutls_time_func time_func);</span>
<span id="LC7" class="line" lang="plaintext"></span>
<span id="LC8" class="line" lang="plaintext"> /* For use in callbacks */</span>
<span id="LC9" class="line" lang="plaintext">+extern _SYM_EXPORT gnutls_free_function gnutls_free;</span>
<span id="LC10" class="line" lang="plaintext">+__attribute__ ((malloc (gnutls_free, 1)))</span>
<span id="LC11" class="line" lang="plaintext"> extern _SYM_EXPORT gnutls_alloc_function gnutls_malloc;</span>
<span id="LC12" class="line" lang="plaintext">+__attribute__ ((malloc (gnutls_free, 1)))</span>
<span id="LC13" class="line" lang="plaintext"> extern _SYM_EXPORT gnutls_realloc_function gnutls_realloc;</span>
<span id="LC14" class="line" lang="plaintext">+__attribute__ ((malloc (gnutls_free, 1)))</span>
<span id="LC15" class="line" lang="plaintext"> extern _SYM_EXPORT gnutls_calloc_function gnutls_calloc;</span>
<span id="LC16" class="line" lang="plaintext">-extern _SYM_EXPORT gnutls_free_function gnutls_free;</span>
<span id="LC17" class="line" lang="plaintext"></span>
<span id="LC18" class="line" lang="plaintext"> #ifdef GNUTLS_INTERNAL_BUILD</span>
<span id="LC19" class="line" lang="plaintext"> #define gnutls_free(a) gnutls_free((void *) (a)), a=NULL</span></code></pre>
<copy-code></copy-code>
</div>
<p dir="auto" style="color: #303030; margin: 0 0 16px;" align="initial">Take a look at:</p>
<ul dir="auto" style="text-align: initial; list-style-type: disc; margin: 0; padding: 0;">
<li style="margin-top: 0; line-height: 1.6em; margin-left: 25px; padding-left: 3px;">
<a href="https://developers.redhat.com/blog/2021/04/30/detecting-memory-management-bugs-with-gcc-11-part-1-understanding-dynamic-allocation#attribute_malloc" rel="nofollow noreferrer noopener" target="_blank" style="margin-top: 0;">https://developers.redhat.com/blog/2021/04/30/detecting-memory-management-bugs-with-gcc-11-part-1-understanding-dynamic-allocation#attribute_malloc</a> (this is the main one)</li>
<li style="line-height: 1.6em; margin-left: 25px; padding-left: 3px;"><a href="https://developers.redhat.com/blog/2021/01/28/static-analysis-updates-in-gcc-11" rel="nofollow noreferrer noopener" target="_blank" style="margin-top: 0;">https://developers.redhat.com/blog/2021/01/28/static-analysis-updates-in-gcc-11</a></li>
<li style="line-height: 1.6em; margin-left: 25px; padding-left: 3px;"><a href="https://developers.redhat.com/articles/2022/04/12/state-static-analysis-gcc-12-compiler" rel="nofollow noreferrer noopener" target="_blank" style="margin-top: 0;">https://developers.redhat.com/articles/2022/04/12/state-static-analysis-gcc-12-compiler</a></li>
</ul>
</div>

</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>

</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #666;">

<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/-/merge_requests/1652">view it on GitLab</a>.
<br>
You're receiving this email because of your account on <a target="_blank" rel="noopener noreferrer" href="https://gitlab.com">gitlab.com</a>. <a href="https://gitlab.com/-/sent_notifications/8f452e693b92f7e895737a676f890985/unsubscribe" target="_blank" rel="noopener noreferrer">Unsubscribe</a> from this thread · <a href="https://gitlab.com/-/profile/notifications" target="_blank" rel="noopener noreferrer" class="mng-notif-link">Manage all notifications</a> · <a href="https://gitlab.com/help" target="_blank" rel="noopener noreferrer" class="help-link">Help</a>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Merge request","url":"https://gitlab.com/gnutls/gnutls/-/merge_requests/1652"}}</script>


</p>
</div>
</body>
</html>