Skip to content

Commit

Permalink
Fixed memcpy for template
Browse files Browse the repository at this point in the history
Signed-off-by: Cervenka Dusan <[email protected]>
  • Loading branch information
Hadatko committed Mar 7, 2023
1 parent 11f2a0a commit 6cff6bd
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions erpcgen/src/templates/c_coders.template
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,16 @@ if (({$info.sizeTemp} <= {$info.maxSize}) && ({$info.dataTemp} != NULL))
{% if source == "server" || info.useMallocOnClientSide == true %}
{$indent}{$info.name} = (uint8_t *) erpc_malloc({$info.maxSize} * sizeof(uint8_t));
{% if generateAllocErrorChecks == true %}
{$indent}if (({$info.name} == NULL) && ({$info.sizeTemp} > 0))
{$indent}if ({$info.sizeTemp} > 0)
{$indent}{
{$indent} codec->updateStatus(kErpcStatus_MemoryError);
{$indent}}
{$indent}else
{$indent}{
{$indent} memcpy({$info.name}, {$info.dataTemp}, {$info.sizeTemp});
{$indent} if ({$info.name} == NULL)
{$indent} {
{$indent} codec->updateStatus(kErpcStatus_MemoryError);
{$indent} }
{$indent} else
{$indent} {
{$indent} memcpy({$info.name}, {$info.dataTemp}, {$info.sizeTemp});
{$indent} }
{$indent}}
{% else -- generateAllocErrorChecks == true %}
{$indent}memcpy({$info.name}, {$info.dataTemp}, {$info.sizeTemp});
Expand Down

0 comments on commit 6cff6bd

Please sign in to comment.