Address some spurious Clang static analyzer warnings

Signed-off-by: Erik Boasson <eb@ilities.com>

Fix typo in dlopen_unknown test

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2020-01-19 17:00:18 +01:00 committed by eboasson
parent 97c3025e54
commit 68f789d77b
6 changed files with 20 additions and 10 deletions

View file

@ -403,6 +403,7 @@ void dds_qset_prop (dds_qos_t * __restrict qos, const char * name, const char *
dds_qprop_init (qos);
if (dds_qprop_get_index (qos, name, &i))
{
assert (&qos->property.value.props[i] != NULL); /* for Clang static analyzer */
dds_free (qos->property.value.props[i].value);
qos->property.value.props[i].value = dds_string_dup (value);
}
@ -426,6 +427,7 @@ void dds_qset_bprop (dds_qos_t * __restrict qos, const char * name, const void *
dds_qprop_init (qos);
if (dds_qbprop_get_index (qos, name, &i))
{
assert (&qos->property.binary_value.props[i].value != NULL); /* for Clang static analyzer */
dds_qos_data_copy_in (&qos->property.binary_value.props[i].value, value, sz, true);
}
else

View file

@ -11,6 +11,7 @@
*/
#include "CUnit/Test.h"
#include "dds/dds.h"
#include <assert.h>
/****************************************************************************
* Convenience global policies
@ -746,6 +747,7 @@ CU_Test(ddsc_qos, bproperty, .init=qos_init, .fini=qos_fini)
CU_ASSERT_FATAL(dds_qget_bprop (g_qos, c_bproperty_names[0], &bvalue, &size));
CU_ASSERT_FATAL (bvalue != NULL);
CU_ASSERT_EQUAL_FATAL (size, 3);
assert (c_bproperty_values[0] != NULL); /* for Clang static analyzer */
CU_ASSERT_EQUAL_FATAL (memcmp (bvalue, c_bproperty_values[0], size), 0);
dds_free (bvalue);
@ -754,6 +756,7 @@ CU_Test(ddsc_qos, bproperty, .init=qos_init, .fini=qos_fini)
CU_ASSERT_FATAL (dds_qget_bprop (g_qos, c_bproperty_names[0], &bvalue, &size));
CU_ASSERT_FATAL (bvalue != NULL);
CU_ASSERT_EQUAL_FATAL (size, 3);
assert (c_bproperty_values[1] != NULL); /* for Clang static analyzer */
CU_ASSERT_EQUAL_FATAL (memcmp (bvalue, c_bproperty_values[1], size), 0);
dds_free (bvalue);
dds_qset_bprop (g_qos, c_bproperty_names[0], &c_bproperty_values[0], 3);
@ -782,11 +785,13 @@ CU_Test(ddsc_qos, bproperty, .init=qos_init, .fini=qos_fini)
CU_ASSERT_FATAL (dds_qget_bprop (g_qos, c_bproperty_names[0], &bvalue, &size));
CU_ASSERT_FATAL (bvalue != NULL);
CU_ASSERT_EQUAL_FATAL (size, 3);
assert (c_bproperty_values[0] != NULL); /* for Clang static analyzer */
CU_ASSERT_EQUAL_FATAL (memcmp (bvalue, c_bproperty_values[0], size), 0);
dds_free (bvalue);
CU_ASSERT_FATAL (dds_qget_bprop (g_qos, c_bproperty_names[2], &bvalue, &size));
CU_ASSERT_FATAL (bvalue != NULL);
CU_ASSERT_EQUAL_FATAL (size, 3);
assert (c_bproperty_values[2] != NULL); /* for Clang static analyzer */
CU_ASSERT_EQUAL_FATAL (memcmp (bvalue, c_bproperty_values[2], size), 0);
dds_free (bvalue);
dds_qunset_bprop (g_qos, c_bproperty_names[0]);
@ -809,6 +814,7 @@ CU_Test(ddsc_qos, property_mixed, .init=qos_init, .fini=qos_fini)
CU_ASSERT_FATAL (dds_qget_bprop (g_qos, c_property_names[0], &bvalue, &size));
CU_ASSERT_FATAL (bvalue != NULL);
CU_ASSERT_EQUAL_FATAL (size, 3);
assert (c_bproperty_values[0] != NULL); /* for Clang static analyzer */
CU_ASSERT_EQUAL_FATAL (memcmp (bvalue, c_bproperty_values[0], size), 0);
dds_free (bvalue);
CU_ASSERT_FATAL (dds_qget_prop (g_qos, c_property_names[0], &value));