diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2010-04-04 18:44:36 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2010-04-04 18:44:36 +0000 |
commit | 7049f972404064683b156346f4267d1b5a676358 (patch) | |
tree | 171db02e96b2ab5fda6de490f4cd44c6d68787e0 /src/select/computed.c | |
parent | 796ab0878d70286fa52d4317d73a5d5688cef452 (diff) | |
download | libcss-7049f972404064683b156346f4267d1b5a676358.tar.gz libcss-7049f972404064683b156346f4267d1b5a676358.tar.bz2 |
Correct management of string references in computed styles.
svn path=/trunk/libcss/; revision=10240
Diffstat (limited to 'src/select/computed.c')
-rw-r--r-- | src/select/computed.c | 78 |
1 files changed, 75 insertions, 3 deletions
diff --git a/src/select/computed.c b/src/select/computed.c index 72d3922..57f50cb 100644 --- a/src/select/computed.c +++ b/src/select/computed.c @@ -114,17 +114,69 @@ css_error css_computed_style_destroy(css_computed_style *style) if (style->uncommon != NULL) { if (style->uncommon->counter_increment != NULL) { + css_computed_counter *c; + + for (c = style->uncommon->counter_increment; + c->name != NULL; c++) { + lwc_string_unref(c->name); + } + style->alloc(style->uncommon->counter_increment, 0, style->pw); } if (style->uncommon->counter_reset != NULL) { + css_computed_counter *c; + + for (c = style->uncommon->counter_reset; + c->name != NULL; c++) { + lwc_string_unref(c->name); + } + style->alloc(style->uncommon->counter_reset, 0, style->pw); } - if (style->uncommon->cursor != NULL) + if (style->uncommon->cursor != NULL) { + lwc_string **s; + + for (s = style->uncommon->cursor; *s != NULL; s++) { + lwc_string_unref(*s); + } + style->alloc(style->uncommon->cursor, 0, style->pw); + } + + if (style->uncommon->content != NULL) { + css_computed_content_item *c; + + for (c = style->uncommon->content; + c->type != CSS_COMPUTED_CONTENT_NONE; + c++) { + switch (c->type) { + case CSS_COMPUTED_CONTENT_STRING: + lwc_string_unref(c->data.string); + break; + case CSS_COMPUTED_CONTENT_URI: + lwc_string_unref(c->data.uri); + break; + case CSS_COMPUTED_CONTENT_ATTR: + lwc_string_unref(c->data.attr); + break; + case CSS_COMPUTED_CONTENT_COUNTER: + lwc_string_unref(c->data.counter.name); + break; + case CSS_COMPUTED_CONTENT_COUNTERS: + lwc_string_unref(c->data.counters.name); + lwc_string_unref(c->data.counters.sep); + break; + default: + break; + } + } + + style->alloc(style->uncommon->content, 0, style->pw); + } style->alloc(style->uncommon, 0, style->pw); } @@ -137,11 +189,31 @@ css_error css_computed_style_destroy(css_computed_style *style) style->alloc(style->aural, 0, style->pw); } - if (style->font_family != NULL) + if (style->font_family != NULL) { + lwc_string **s; + + for (s = style->font_family; *s != NULL; s++) { + lwc_string_unref(*s); + } + style->alloc(style->font_family, 0, style->pw); + } + + if (style->quotes != NULL) { + lwc_string **s; + + for (s = style->quotes; *s != NULL; s++) { + lwc_string_unref(*s); + } - if (style->quotes != NULL) style->alloc(style->quotes, 0, style->pw); + } + + if (style->list_style_image != NULL) + lwc_string_unref(style->list_style_image); + + if (style->background_image != NULL) + lwc_string_unref(style->background_image); style->alloc(style, 0, style->pw); |