<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
Hi,<br><br>I've run into crash problems with h5utils program h5topng. I've read the bug report thread #650488 and am using h5utils 1.12.1-2 on Ubuntu 12.04 desktop with kernel 3.2.0-25-generic-pae.<br><br>The crash occurs on line 443 of writepng.c which is:<br><br>     /* if you malloced the palette, free it here */<br>#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4<br>     png_free(png_ptr, palette);<br>     palette = NULL;<br>#else<br>     free(info_ptr->palette);<br>#endif<br><br>The problem is with calling png_free on line 443 because there is no check for whether or not the palette was malloced. In the function writepng where the malloc occurs the value of 'eight_bit' is checked; if 'eight_bit' is true then the palette is malloced.<br><br>Therefore the same 'eight_bit' needs to be checked on line 443 before png_free is called. When I apply this change the crash problem is fixed.<br>The fix should be:<br><br>     /* if you malloced the palette, free it here */<br>#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4<br>     if (eight_bit) {<br>          png_free(png_ptr, palette);<br>     }<br><br>     palette = NULL;<br>#else<br>     free(info_ptr->palette);<br>#endif<br><br>Can you please review my suggestion and let me know what you think?<br><br><br><br>Best regards,<br>Deniz Eren<br><br>                                    </div></body>
</html>