Fix: relayd viewer stream: unhandled out of memory error
[lttng-tools.git] / src / bin / lttng-relayd / viewer-stream.c
index 5ab7be790de867f42676f8c6c84bd2e86bfb7083..37486293f8e8b5df965b2054978cee3aa3b46566 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #define _GNU_SOURCE
+#define _LGPL_SOURCE
 #include <common/common.h>
 #include <common/index/index.h>
 
@@ -57,8 +58,16 @@ struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
        vstream->session_id = stream->session_id;
        vstream->stream_handle = stream->stream_handle;
        vstream->path_name = strndup(stream->path_name, LTTNG_VIEWER_PATH_MAX);
+       if (vstream->path_name == NULL) {
+               PERROR("relay viewer path_name alloc");
+               goto error;
+       }
        vstream->channel_name = strndup(stream->channel_name,
                        LTTNG_VIEWER_NAME_MAX);
+       if (vstream->channel_name == NULL) {
+               PERROR("relay viewer channel_name alloc");
+               goto error;
+       }
        vstream->tracefile_count = stream->tracefile_count;
        vstream->metadata_flag = stream->metadata_flag;
        vstream->tracefile_count_last = -1ULL;
This page took 0.024192 seconds and 4 git commands to generate.