summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2016-11-07 07:03:10 (GMT)
committerAndreas Schneider <asn@cryptomilk.org>2016-11-07 07:11:39 (GMT)
commit5182612d58b1670008b37f64fc92fc32382bd2d5 (patch)
treeca527fc15cf5d5a43fca7d3efdca13e967f3c1e1
parent26717f4909039803b231434740ef3ce005258dae (diff)
downloadcmocka-5182612d58b1670008b37f64fc92fc32382bd2d5.zip
cmocka-5182612d58b1670008b37f64fc92fc32382bd2d5.tar.gz
cmocka-5182612d58b1670008b37f64fc92fc32382bd2d5.tar.bz2
cmocka: Leave if expected_call is NULL
CID 1365415 Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--src/cmocka.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cmocka.c b/src/cmocka.c
index e21ad26..6c79a20 100644
--- a/src/cmocka.c
+++ b/src/cmocka.c
@@ -914,15 +914,16 @@ void _function_called(const char *const function,
{
ListNode *first_value_node = NULL;
ListNode *value_node = NULL;
- FuncOrderingValue *expected_call;
int rc;
rc = list_first(&global_call_ordering_head, &value_node);
first_value_node = value_node;
if (rc) {
+ FuncOrderingValue *expected_call;
int cmp;
expected_call = (FuncOrderingValue *)value_node->value;
+
cmp = strcmp(expected_call->function, function);
if (value_node->refcount < -1) {
/*
@@ -948,7 +949,7 @@ void _function_called(const char *const function,
cmp = strcmp(expected_call->function, function);
}
- if (value_node == first_value_node->prev) {
+ if (expected_call == NULL || value_node == first_value_node->prev) {
cm_print_error(SOURCE_LOCATION_FORMAT
": error: No expected mock calls matching "
"called() invocation in %s",