From 6189758875b3e8e34fcb3e002a5bbbd7648be754 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 8 Nov 2013 12:06:32 +0000 Subject: Handle css__stylesheet_style_append() returning error. Coverity #1127060. --- src/parse/properties/background_position.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/parse/properties/background_position.c b/src/parse/properties/background_position.c index 992372b..d4b31dc 100644 --- a/src/parse/properties/background_position.c +++ b/src/parse/properties/background_position.c @@ -194,12 +194,30 @@ css_error css__parse_background_position(css_language *c, if ((flags & FLAG_INHERIT) == false) { if (value[0] == BACKGROUND_POSITION_HORZ_SET) { - css__stylesheet_style_append(result, length[0]); - css__stylesheet_style_append(result, unit[0]); + error = css__stylesheet_style_append(result, length[0]); + if (error != CSS_OK) { + *ctx = orig_ctx; + return error; + } + + error = css__stylesheet_style_append(result, unit[0]); + if (error != CSS_OK) { + *ctx = orig_ctx; + return error; + } } if (value[1] == BACKGROUND_POSITION_VERT_SET) { - css__stylesheet_style_append(result, length[1]); - css__stylesheet_style_append(result, unit[1]); + error = css__stylesheet_style_append(result, length[1]); + if (error != CSS_OK) { + *ctx = orig_ctx; + return error; + } + + error = css__stylesheet_style_append(result, unit[1]); + if (error != CSS_OK) { + *ctx = orig_ctx; + return error; + } } } -- cgit v1.2.3