mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-28 17:15:57 +00:00
svg_loader: preventing memory leak
A memory leak occured when the 'id' attribute was given multiple times for a given gradient element. Fixed.
This commit is contained in:
parent
eb75745a19
commit
1f6c236fa3
1 changed files with 2 additions and 0 deletions
|
@ -2098,6 +2098,7 @@ static bool _attrParseRadialGradientNode(void* data, const char* key, const char
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(key, "id")) {
|
if (!strcmp(key, "id")) {
|
||||||
|
if (grad->id && value) free(grad->id);
|
||||||
grad->id = _copyId(value);
|
grad->id = _copyId(value);
|
||||||
} else if (!strcmp(key, "spreadMethod")) {
|
} else if (!strcmp(key, "spreadMethod")) {
|
||||||
grad->spread = _parseSpreadValue(value);
|
grad->spread = _parseSpreadValue(value);
|
||||||
|
@ -2286,6 +2287,7 @@ static bool _attrParseLinearGradientNode(void* data, const char* key, const char
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(key, "id")) {
|
if (!strcmp(key, "id")) {
|
||||||
|
if (grad->id && value) free(grad->id);
|
||||||
grad->id = _copyId(value);
|
grad->id = _copyId(value);
|
||||||
} else if (!strcmp(key, "spreadMethod")) {
|
} else if (!strcmp(key, "spreadMethod")) {
|
||||||
grad->spread = _parseSpreadValue(value);
|
grad->spread = _parseSpreadValue(value);
|
||||||
|
|
Loading…
Add table
Reference in a new issue