Commit 41bfd44
Davidlohr Bueso
examples: fix static analyzer warnings in fmapi-mctp
Fix two issues caught by static analysis:
1. Null pointer passed to execvp(): Add validation for argc, argv, and
argv[0] before calling execute_cmd() to ensure non-null arguments.
2. Use of memory after free: Remove free(ext_list) calls from send_add()
and send_release() error paths. These functions don't own ext_list -
the caller allocates it and is responsible for freeing it. The
original code caused use-after-free when the loop continued after a
failed send, and potential double-free at exit_free_ctx.
Co-Authored-By: Claude AI
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>1 parent ff96018 commit 41bfd44
1 file changed
Lines changed: 3 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
129 | | - | |
| 128 | + | |
130 | 129 | | |
131 | | - | |
132 | 130 | | |
133 | 131 | | |
134 | 132 | | |
| |||
165 | 163 | | |
166 | 164 | | |
167 | 165 | | |
168 | | - | |
169 | | - | |
| 166 | + | |
170 | 167 | | |
171 | | - | |
172 | 168 | | |
173 | 169 | | |
174 | 170 | | |
| |||
378 | 374 | | |
379 | 375 | | |
380 | 376 | | |
381 | | - | |
| 377 | + | |
382 | 378 | | |
383 | 379 | | |
384 | 380 | | |
| |||
0 commit comments