Skip to content

Commit

Permalink
Fixing memory leak when kafka producer is not present.
Browse files Browse the repository at this point in the history
Closes-Bug:1586189

Change-Id: I3c5cec11145e2650ab6e40bfda8dd633ec7bfca8
  • Loading branch information
anishmehta committed Jun 29, 2016
1 parent 720977c commit 8af0a45
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/analytics/OpServerProxy.cc
Original file line number Diff line number Diff line change
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 8af0a45

Please sign in to comment.