check the allocated or passed variables has proper state.
Signed-off-by: Hyoung Joo Ahn <hello.ahn@samsung.com>
/** @todo With option-2, allow to change output format */
str = data->labels.labels[max_index];
- size = strlen (str);
+
+ if (!str || (size = strlen (str)) == 0) {
+ ml_loge ("Invalid labels. Please check the label data.");
+ return GST_FLOW_ERROR;
+ }
/* Ensure we have outbuf properly allocated */
if (gst_buffer_get_size (outbuf) == 0) {
guint pose_size = data->total_labels;
pose **XYdata = g_new0 (pose *, pose_size);
+ if (!XYdata) {
+ ml_loge ("The memory allocation is failed.");
+ return;
+ }
for (i = 0; i < pose_size; i++) {
XYdata[i] = &g_array_index (results, pose, i);
static gchar *
strcpy2 (gchar * dest, const gchar * src)
{
+ if (!dest || !src) {
+ ml_loge ("Failed to copy a string. The variables shouldn't be NULL.");
+ return NULL;
+ }
memcpy (dest, src, strlen (src));
return dest + strlen (src);
}