xcf-load: g_free name in error cases to avoid leak

In all 3 cases:
 - xcf_read_string allocates a new string into name.
 - If an error is detected, we return early - name remains unused.
Therefore we add g_free (name) to these early returns to avoid a leak.
This commit is contained in:
Andrzej Hunt 2021-08-27 18:10:08 +02:00 committed by Jehan
parent 76b11a5f69
commit 59eae13aec
1 changed files with 3 additions and 0 deletions

View File

@ -1954,6 +1954,7 @@ xcf_load_layer (XcfInfo *info,
break;
default:
g_free (name);
return NULL;
}
@ -1977,6 +1978,7 @@ xcf_load_layer (XcfInfo *info,
}
else
{
g_free (name);
return NULL;
}
}
@ -2830,6 +2832,7 @@ xcf_load_old_path (XcfInfo *info,
{
g_printerr ("Unknown path type. Possibly corrupt XCF file");
g_free (name);
return FALSE;
}