summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-01-10 13:12:44 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-01-10 13:12:44 +0000
commit061f6295064ac019a1373d5cde78be2be7e0c393 (patch)
tree2a621fdd78e4644fc89274d129ae6df70b2beb85
parent730f0ecafbb6e6835aef92d279c21789853c2f21 (diff)
downloadlibcss-061f6295064ac019a1373d5cde78be2be7e0c393.tar.gz
libcss-061f6295064ac019a1373d5cde78be2be7e0c393.tar.bz2
Squash memory leaks
svn path=/trunk/libcss/; revision=6014
-rw-r--r--src/parse/properties.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/parse/properties.c b/src/parse/properties.c
index 51a87a3..cfedec5 100644
--- a/src/parse/properties.c
+++ b/src/parse/properties.c
@@ -2710,8 +2710,11 @@ css_error parse_font_family(css_language *c,
/* Pass 2: populate bytecode */
token = parserutils_vector_iterate(vector, ctx);
if (token == NULL || (token->type != CSS_TOKEN_IDENT &&
- token->type != CSS_TOKEN_STRING))
+ token->type != CSS_TOKEN_STRING)) {
+ css_stylesheet_style_destroy(c->sheet, *result);
+ *result = NULL;
return CSS_INVALID;
+ }
if (token->type == CSS_TOKEN_IDENT &&
token->ilower == c->strings[INHERIT]) {
@@ -2813,8 +2816,11 @@ css_error parse_font_family(css_language *c,
perror = parserutils_hash_insert(
c->sheet->dictionary,
buf, len, &name);
- if (perror != PARSERUTILS_OK)
+ if (perror != PARSERUTILS_OK) {
+ css_stylesheet_style_destroy(c->sheet, *result);
+ *result = NULL;
return css_error_from_parserutils_error(perror);
+ }
}
}
@@ -2839,6 +2845,8 @@ css_error parse_font_family(css_language *c,
sizeof(token->idata));
ptr += sizeof(token->idata);
} else {
+ css_stylesheet_style_destroy(c->sheet, *result);
+ *result = NULL;
return CSS_INVALID;
}
@@ -2851,8 +2859,12 @@ css_error parse_font_family(css_language *c,
consumeWhitespace(vector, ctx);
token = parserutils_vector_peek(vector, *ctx);
- if (token == NULL || tokenIsChar(token, '!'))
+ if (token == NULL || tokenIsChar(token, '!')) {
+ css_stylesheet_style_destroy(c->sheet,
+ *result);
+ *result = NULL;
return CSS_INVALID;
+ }
}
first = false;
@@ -2871,8 +2883,11 @@ css_error parse_font_family(css_language *c,
}
error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
+ if (error != CSS_OK) {
+ css_stylesheet_style_destroy(c->sheet, *result);
+ *result = NULL;
return error;
+ }
return CSS_OK;
}