Code

src/utils_db_query.c: Check return status of strjoin().
authorFlorian Forster <octo@collectd.org>
Sat, 6 Aug 2016 18:15:51 +0000 (20:15 +0200)
committerFlorian Forster <octo@collectd.org>
Sat, 6 Aug 2016 18:17:13 +0000 (20:17 +0200)
Fixes: #4
src/utils_db_query.c

index 6b3c056cb31d6bad732ec133a658c8645a044069..9a16873922290730218e40a1ecfe17f8a2592f02 100644 (file)
@@ -236,15 +236,27 @@ static int udb_result_submit (udb_result_t *r, /* {{{ */
   {
     if (r->instance_prefix == NULL)
     {
-      strjoin (vl.type_instance, sizeof (vl.type_instance),
+      int status = strjoin (vl.type_instance, sizeof (vl.type_instance),
           r_area->instances_buffer, r->instances_num, "-");
+      if (status != 0)
+      {
+        ERROR ("udb_result_submit: creating type_instance failed with status %d.",
+            status);
+        return (status);
+      }
     }
     else
     {
       char tmp[DATA_MAX_NAME_LEN];
 
-      strjoin (tmp, sizeof (tmp), r_area->instances_buffer,
+      int status = strjoin (tmp, sizeof (tmp), r_area->instances_buffer,
           r->instances_num, "-");
+      if (status != 0)
+      {
+        ERROR ("udb_result_submit: creating type_instance failed with status %d.",
+            status);
+        return (status);
+      }
       tmp[sizeof (tmp) - 1] = 0;
 
       snprintf (vl.type_instance, sizeof (vl.type_instance), "%s-%s",