Skip to content
This repository has been archived by the owner on Jul 8, 2022. It is now read-only.

Add Tango::string_free and fix memory leak in zmq_event_subscription_change() (#457) #460

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ enable_testing()
#need to define the version of the library
set(MAJOR_VERSION "9")
set(MINOR_VERSION "3")
set(PATCH_VERSION "1")
set(PATCH_VERSION "2")

if(WIN32)
include(configure/cmake_win_defs.cmake)
Expand Down
4 changes: 3 additions & 1 deletion cppapi/server/eventcmds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,9 @@ DevVarLongStringArray *DServer::zmq_event_subscription_change(const Tango::DevVa
ret_data->svalue[size] = Tango::string_dup(event_topic.c_str());

string channel_name = ev->get_fqdn_prefix();
channel_name += dev->adm_name();
char * adm_name = dev->adm_name();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know!

channel_name += adm_name;
Tango::string_free(adm_name);
transform(channel_name.begin(), channel_name.end(), channel_name.begin(), ::tolower);
assert(!(channel_name.empty()));
cout4 << "Sending channel_name = " << channel_name << endl;
Expand Down
2 changes: 2 additions & 0 deletions cppapi/server/tango_const.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,8 @@ const char* const API_ZmqInitFailed = "API_ZmqInitFailed";

inline char * string_dup(char *s) {return CORBA::string_dup(s);}
inline char * string_dup(const char *s) {return CORBA::string_dup(s);}
// A short inline function to hide the CORBA::string_free function
inline void string_free(char *s) {return CORBA::string_free(s);}

//
// Many, many typedef
Expand Down