From 7ff27c1699efe0e16625459814b4ead562f5f4f7 Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Mon, 26 Aug 2024 12:51:41 -0600 Subject: [PATCH] variant: return NULL on allocation exception (CID 507937) Signed-off-by: Eduardo Silva --- src/cfl_variant.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cfl_variant.c b/src/cfl_variant.c index 1b688b8..cc2a8a7 100644 --- a/src/cfl_variant.c +++ b/src/cfl_variant.c @@ -136,7 +136,7 @@ struct cfl_variant *cfl_variant_create_from_bytes(char *value, size_t length, in instance->data.as_bytes = cfl_sds_create_len(value, length); if (instance->data.as_bytes == NULL) { free(instance); - instance = NULL; + return NULL; } } cfl_variant_size_set(instance, length);