Commit cc7b409
authored
usm: native-tls: Fix a leak (#43378)
### What does this PR do?
Fixes a memory leak in the native-TLS eBPF code by moving the map cleanup to happen before the null check of the connection tuple.
### Motivation
Previously, when `tup_from_ssl_ctx` returned NULL, we would return early without cleaning up the `ssl_sock_by_ctx` map entry. This caused a leak where the SSL context entries would remain in the map even though they were no longer needed.
By moving the `bpf_map_delete_elem` call before the null check, we ensure the map entry is always cleaned up regardless of whether the tuple lookup succeeds.
### Describe how you validated your changes
### Additional Notes
Co-authored-by: guy.arbitman <guy.arbitman@datadoghq.com>1 parent d356ebe commit cc7b409
1 file changed
+6
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | 364 | | |
370 | | - | |
371 | | - | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
372 | 368 | | |
373 | 369 | | |
374 | 370 | | |
| |||
526 | 522 | | |
527 | 523 | | |
528 | 524 | | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | 525 | | |
534 | 526 | | |
535 | | - | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
536 | 530 | | |
537 | 531 | | |
538 | 532 | | |
| |||
0 commit comments