Skip to content

Commit

Permalink
Fix defects in pingpong sample apps (#266)
Browse files Browse the repository at this point in the history
- Fix wrong malloc size in pong_app.c
- Fix wrong return values in ping_app and pong_app

Signed-off-by: Kasiewicz, Marek <marek.kasiewicz@intel.com>
  • Loading branch information
Sakoram authored Nov 26, 2024
1 parent 90e31b1 commit 3ade772
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sdk/samples/ping_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,5 +397,5 @@ int main(int argc, char **argv)

mesh_delete_client(&client);

exit(-1);
return 0;
}
8 changes: 3 additions & 5 deletions sdk/samples/pong_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ int main(int argc, char **argv)
exit(-1);
}

pthread_t *pong_threads = malloc(config.threads_num * sizeof(pthread_t *));
int *threads_id = malloc(config.threads_num * sizeof(int *));
pthread_t *pong_threads = malloc(config.threads_num * sizeof(pthread_t));
int *threads_id = malloc(config.threads_num * sizeof(int));

for (int i = 0; i < config.threads_num; i++) {
threads_id[i] = i;
Expand All @@ -311,9 +311,7 @@ int main(int argc, char **argv)
free(pong_threads);
free(threads_id);

return 0;

mesh_delete_client(&client);

exit(-1);
return 0;
}

0 comments on commit 3ade772

Please sign in to comment.