From 0f9419433903f40d40bfac538ca260568ee4ffdb Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 24 Feb 2020 09:41:16 +0000 Subject: 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 --- src/parse/mq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- cgit v1.2.3