summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <Michael Drake tlsa@netsurf-browser.org>2020-02-24 09:41:16 +0000
committerMichael Drake <Michael Drake tlsa@netsurf-browser.org>2020-02-24 09:41:16 +0000
commit0f9419433903f40d40bfac538ca260568ee4ffdb (patch)
tree4708777850a9547d851b00a4a0abb9dbe7b2c388
parent54ddec960162bb055b7dc50b1314763fbf763b60 (diff)
downloadlibcss-0f9419433903f40d40bfac538ca260568ee4ffdb.tar.gz
libcss-0f9419433903f40d40bfac538ca260568ee4ffdb.tar.bz2
Media queries: Don't set parts before allocation has failed.
Squashes scan-build error about dereference of parts if the allocation fails. Signed-off-by: Michael Drake <Michael Drake tlsa@netsurf-browser.org>
-rw-r--r--src/parse/mq.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/parse/mq.c b/src/parse/mq.c
index c6ebe84..b0e47c3 100644
--- a/src/parse/mq.c
+++ b/src/parse/mq.c
@@ -800,13 +800,13 @@ static css_error mq_parse_condition(lwc_string **strings,
}
result->negate = 1;
- result->nparts = 1;
result->parts = malloc(sizeof(*result->parts));
if (result->parts == NULL) {
css__mq_cond_or_feature_destroy(cond_or_feature);
css__mq_cond_destroy(result);
return CSS_NOMEM;
}
+ result->nparts = 1;
result->parts[0] = cond_or_feature;
*cond = result;