Browse Source

Closed memory leak with lack of memory during retrieval of HFS+ names.

Coverity CID 12580.
release-1.5.4.branch
Thomas Schmitt 6 years ago
parent
commit
5ac3216933
  1. 12
      libisofs/hfsplus.c

12
libisofs/hfsplus.c

@ -137,8 +137,10 @@ int iso_get_hfsplus_name(char *input_charset, int imgid, char *name,
curlen = ucslen (ucs_name);
*result = calloc ((curlen * HFSPLUS_MAX_DECOMPOSE_LEN + 1),
sizeof (uint16_t));
if (*result == NULL)
if (*result == NULL) {
free(ucs_name);
return ISO_OUT_OF_MEM;
}
for (iptr = ucs_name, optr = *result; *iptr; iptr++)
{
@ -208,8 +210,12 @@ int iso_get_hfsplus_name(char *input_charset, int imgid, char *name,
while (done);
*cmp_name = calloc ((ucslen (*result) + 1), sizeof (uint16_t));
if (*cmp_name == NULL)
return ISO_OUT_OF_MEM;
if (*cmp_name == NULL) {
free(ucs_name);
free(*result);
*result = NULL;
return ISO_OUT_OF_MEM;
}
for (iptr = *result, optr = *cmp_name; *iptr; iptr++)
{

Loading…
Cancel
Save