Clean-up: unchecked return value
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 31 Jan 2020 23:06:09 +0000 (18:06 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 31 Jan 2020 23:06:09 +0000 (18:06 -0500)
The return value of lttng_dynamic_buffer_set_size() is ignored in
lttng_dynamic_array_clear(). It is okay as
lttng_dynamic_buffer_set_size(..., 0) can't fail. However, it
results in a Coverity Scan warning.

1412201 Unchecked return value

If the function returns an error value, the error value may be
mistaken for a normal value.

In lttng_dynamic_array_clear: Value returned from a function is not
checked for errors before being used (CWE-252)

Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I1943e299e4cb5752711f2d25b0dd9a5c44a28a18

src/common/dynamic-array.c

index f737c982d6c1b7bfa39212a43ce6a7d404d63449..198df19bbaa89d5bff75911fdf2d1b915b0cfd3e 100644 (file)
@@ -89,7 +89,7 @@ void lttng_dynamic_array_clear(struct lttng_dynamic_array *array)
                }
        }
 
-       lttng_dynamic_buffer_set_size(&array->buffer, 0);
+       (void) lttng_dynamic_buffer_set_size(&array->buffer, 0);
        array->size = 0;
 }
 
This page took 0.026057 seconds and 4 git commands to generate.