mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-28 17:15:57 +00:00
svg_loader: fixing memleak
Memory was not freed before reallocation (grad->ref can be overwritten without freeing memory first) - fixed.
This commit is contained in:
parent
6fb0984b49
commit
43e5644e8b
1 changed files with 3 additions and 1 deletions
|
@ -2209,6 +2209,7 @@ static bool _attrParseRadialGradientNode(void* data, const char* key, const char
|
|||
} else if (!strcmp(key, "spreadMethod")) {
|
||||
grad->spread = _parseSpreadValue(value);
|
||||
} else if (!strcmp(key, "href") || !strcmp(key, "xlink:href")) {
|
||||
if (grad->ref && value) free(grad->ref);
|
||||
grad->ref = _idFromHref(value);
|
||||
} else if (!strcmp(key, "gradientUnits") && !strcmp(value, "userSpaceOnUse")) {
|
||||
grad->userSpace = true;
|
||||
|
@ -2398,6 +2399,7 @@ static bool _attrParseLinearGradientNode(void* data, const char* key, const char
|
|||
} else if (!strcmp(key, "spreadMethod")) {
|
||||
grad->spread = _parseSpreadValue(value);
|
||||
} else if (!strcmp(key, "href") || !strcmp(key, "xlink:href")) {
|
||||
if (grad->ref && value) free(grad->ref);
|
||||
grad->ref = _idFromHref(value);
|
||||
} else if (!strcmp(key, "gradientUnits") && !strcmp(value, "userSpaceOnUse")) {
|
||||
grad->userSpace = true;
|
||||
|
|
Loading…
Add table
Reference in a new issue