Skip to content

Commit

Permalink
Merge "Fixing memory leak when kafka producer is not present. Closes-…
Browse files Browse the repository at this point in the history
…Bug:1586189" into R2.22.x
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jul 1, 2016
2 parents c5ca289 + 8af0a45 commit 786f9d4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/analytics/OpServerProxy.cc
Expand Up @@ -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<char *>(value.c_str()), value.length(),
&skey, (void *)gn);
}
}
}

struct RedisInfo {
Expand Down

0 comments on commit 786f9d4

Please sign in to comment.