diff --git a/src/analytics/OpServerProxy.cc b/src/analytics/OpServerProxy.cc index efa018e8eff..82231c6962b 100644 --- a/src/analytics/OpServerProxy.cc +++ b/src/analytics/OpServerProxy.cc @@ -124,16 +124,17 @@ class OpServerProxy::OpServerImpl { LOG(ERROR, "Kafka ignoring KafkaPub"); return; } - char* gn = new char[gen.length()+1]; - strcpy(gn,gen.c_str()); if (producer_) { + char* gn = new char[gen.length()+1]; + strcpy(gn,gen.c_str()); + // Key in Kafka Topic includes UVE Key, Type producer_->produce(topic_[pt].get(), 0, RdKafka::Producer::MSG_COPY, const_cast(value.c_str()), value.length(), &skey, (void *)gn); - } + } } struct RedisInfo {