From: SourceForge.net <no...@so...> - 2009-10-21 09:14:40
|
Bugs item #2883109, was opened at 2009-10-21 10:14 Message generated for change (Tracker Item Submitted) made by dcb314 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=465492&aid=2883109&group_id=52039 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: dcb (dcb314) Assigned to: Nobody/Anonymous (nobody) Summary: iptcutil.c: memory leak Initial Comment: 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; } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=465492&aid=2883109&group_id=52039 |