<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 14px; font-family: Calibri, sans-serif;">
<div style="color: rgb(0, 0, 0);">In attr.m4, is the following code:</div>
<div style="color: rgb(0, 0, 0);"><br>
</div>
<div>
<blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;">
<div style="color: rgb(0, 0, 0);">int</div>
<div style="color: rgb(0, 0, 0);">ncmpii_NC_findattr(const NC_attrarray *ncap,</div>
<div style="color: rgb(0, 0, 0);"> const char *uname)</div>
<div style="color: rgb(0, 0, 0);">{</div>
<div style="color: rgb(0, 0, 0);"> int i;</div>
<div style="color: rgb(0, 0, 0);"> size_t nchars;</div>
<div style="color: rgb(0, 0, 0);"><br>
</div>
<div style="color: rgb(0, 0, 0);"> assert(ncap != NULL);</div>
<div style="color: rgb(0, 0, 0);"><br>
</div>
<div> <font color="#ff0000">char *name = (char *)utf8proc_NFC((const unsigned char *)uname);</font></div>
<div style="color: rgb(0, 0, 0);"> nchars = strlen(name);</div>
<div style="color: rgb(0, 0, 0);"><br>
</div>
<div><span style="color: rgb(0, 0, 0);"> </span><font color="#ff0000">if (ncap->ndefined == 0) return -1;</font> /* none created yet */</div>
<div style="color: rgb(0, 0, 0);"><br>
</div>
<div style="color: rgb(0, 0, 0);"> for (i=0; i<ncap->ndefined; i++) {</div>
<div style="color: rgb(0, 0, 0);"> if (ncap->value[i]->name->nchars == nchars &&</div>
<div style="color: rgb(0, 0, 0);"> strncmp(ncap->value[i]->name->cp, name, nchars) == 0) {</div>
<div style="color: rgb(0, 0, 0);"> free(name);</div>
<div style="color: rgb(0, 0, 0);"> return i;</div>
<div style="color: rgb(0, 0, 0);"> }</div>
<div style="color: rgb(0, 0, 0);"> }</div>
<div style="color: rgb(0, 0, 0);"> free(name);</div>
<div style="color: rgb(0, 0, 0);"><br>
</div>
<div style="color: rgb(0, 0, 0);"> return -1;</div>
<div style="color: rgb(0, 0, 0);">}</div>
</blockquote>
</div>
<blockquote style="color: rgb(0, 0, 0); margin: 0px 0px 0px 40px; border: none; padding: 0px;">
<div><br>
</div>
</blockquote>
<div>If this routine takes the early exit “none created yet”, then “name” will not be freed causing a memory leak. The “if(ncap->ndefined==0) return -1” line should be moved before the line that allocates “name”</div>
<div><br>
</div>
<div>This is parallel-netcdf-1.6.1</div>
<div>..Greg</div>
</body>
</html>