Fix segmentation fault in streaming (#5882)
Vladimir Kobal committed
Apr 17, 2019 at 20:09 UTC
4683084235b4a633f3182b6ad2f1625b8b5f041c
1 file changed
+9
-7
streaming/rrdpush.c
+9
-7
@@ -151,13 +151,15 @@ static inline void rrdpush_send_chart_definition_nolock(RRDSET *st) {
151
152
// properly set the name for the remote end to parse it
153
char *name = "";
154
- if(unlikely(strcmp(st->id, st->name))) {
155
- // they differ
156
- name = strchr(st->name, '.');
157
- if(name)
158
- name++;
159
- else
160
- name = "";
154
+ if(likely(st->name)) {
155
+ if(unlikely(strcmp(st->id, st->name))) {
156
+ // they differ
157
+ name = strchr(st->name, '.');
158
+ if(name)
159
+ name++;
160
+ else
161
+ name = "";
162
+ }
163
}
164
165
// info("CHART '%s' '%s'", st->id, name);