Skip to content

Commit 8cc2e5c

Browse files
committed
fix memory issue in coredx configuration
1 parent ed5d853 commit 8cc2e5c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

srcCxx/shape_configurator_toc_coredx_dds.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,16 @@
1818

1919
void StringSeq_push(DDS::StringSeq &string_seq, const char *elem)
2020
{
21-
string_seq.push_back((char*)elem);
21+
char * e = NULL;
22+
if ( elem )
23+
{
24+
e = new char[strlen(elem)+1];
25+
if ( e )
26+
{
27+
strcpy( e, elem );
28+
string_seq.push_back(e);
29+
}
30+
}
2231
}
2332

2433
const char *get_qos_policy_name(DDS_QosPolicyId_t policy_id)

0 commit comments

Comments
 (0)