[
https://issues.apache.org/jira/browse/TRAFODION-3236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16699467#comment-16699467
]
ASF GitHub Bot commented on TRAFODION-3236:
-------------------------------------------
Github user prashanth-vasudev commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1749#discussion_r236393855
--- Diff: core/sqf/src/tm/tm.cpp ---
@@ -2789,8 +2789,7 @@ void tm_process_msg(BMS_SRE *pp_sre)
{
short lv_ret;
char la_send_buffer[4096];
- char la_recv_buffer[sizeof(Tm_Req_Msg_Type)];
- char *la_recv_buffer_ddl = NULL;
+ char la_recv_buffer[pp_sre->sre_reqDataSize];
--- End diff --
Would be good to check the size for non zero value. If the caller passes
zero, process will crash at a later point.
> The logic for allocating receive buffer is complex and can be optimized
> -----------------------------------------------------------------------
>
> Key: TRAFODION-3236
> URL: https://issues.apache.org/jira/browse/TRAFODION-3236
> Project: Apache Trafodion
> Issue Type: Improvement
> Components: dtm
> Affects Versions: 2.2.0
> Reporter: Guo Heng
> Assignee: Guo Heng
> Priority: Minor
>
> In the code file:
> [core/sqf/src/tm/tm.cpp|https://github.com/apache/trafodion/pull/1748/commits/be7c999b5cc27c74c5b8004158a2aa18236dd6d9#diff-fc1bfd76bb5a88b2fbcd581c90968da9]
> In the function definition of line 2788, there are two buffer definitions,
> la_recv_buffer and la_recv_buffer_ddl. Maybe we can avoid dynamically
> assigning la_recv_buffer_ddl. It is enough to use only la_recv_buffer, which
> simplifies the logic and reduces the heap pressure.
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)