util/xmlconfig: eliminate memory leak

It fixes coverity issue: CID 1467703: (RESOURCE_LEAK):
`Variable "cp" going out of scope leaks the storage it points to.`

Fixes: 23c3eb1fe1 ("driconf: Delete disjoint range support")
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7021>
This commit is contained in:
Andrii Simiklit
2020-10-06 10:04:55 +03:00
committed by Marge Bot
parent 11389849a4
commit cc00d57a3c

View File

@@ -637,14 +637,20 @@ parseRange(driOptionInfo *info, const char *string)
*sep = '\0';
if (!parseValue(&info->range.start, info->type, cp) ||
!parseValue(&info->range.end, info->type, sep+1))
!parseValue(&info->range.end, info->type, sep+1)) {
free(cp);
return false;
}
if (info->type == DRI_INT &&
info->range.start._int >= info->range.end._int)
info->range.start._int >= info->range.end._int) {
free(cp);
return false;
}
if (info->type == DRI_FLOAT &&
info->range.start._float >= info->range.end._float)
info->range.start._float >= info->range.end._float) {
free(cp);
return false;
}
free(cp);
return true;