YAJL_GET_STRING(array_values[0]) may return NULL if
array_values[0]->string is NULL; passing a NULL parameter to
strcmp() is not recommended, since the resultant behaviour may
be undefined.
Resolve the issue by adding a NULL check for the string returned
by YAJL_GET_STRING.
Fixes: cbq59d853 ("ovs_events: Fix plugin collectd config file")
Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
/* check first element of the array */
str_val = YAJL_GET_STRING(array_values[0]);
- if (strcmp("map", str_val) != 0)
+ if (str_val == NULL || strcmp("map", str_val) != 0)
return NULL;
/* try to find map value by map key */