For source code file tkimg1.3/libtiff/contrib/iptcutil/iptcutil.c
function formatIPTC
I notice the following code
str=(unsigned char *) malloc((unsigned int) (taglen+1));
if (str == (unsigned char *) NULL)
{
printf("Memory allocation failed");
return 0;
}
for (tagindx=0; tagindx<taglen; tagindx++)
{
c = str[tagindx] = getc(ifile);
if (c == EOF)
return -1;
so if the second return is taken, then str is a memory leak. Suggest
new code
str=(unsigned char *) malloc((unsigned int) (taglen+1));
if (str == (unsigned char *) NULL)
{
printf("Memory allocation failed");
return 0;
}
for (tagindx=0; tagindx<taglen; tagindx++)
{
c = str[tagindx] = getc(ifile);
if (c == EOF)
{
free( str);
return -1;
}
Nobody/Anonymous
None
None
Public