open5gs/tests/af
Gaber Stare 7d0026e24e [SBI] Fix double-free
Bug:

A double-free scenario in the error handling path:

When ogs_sbi_send_request_with_sepp_discovery failed, it called
ogs_sbi_xact_remove(xact) internally.
The function then returned false to its caller. The caller
(smf_sbi_discover_and_send) also called ogs_sbi_xact_remove(xact)
on failure.
This caused the discovery_option structure to be freed twice,
leading to the valgrind error:
```
==90== Invalid read of size 8
==90==    at 0x49AFBB6: ogs_sbi_discovery_option_free (message.c:3633)
==90==    by 0x49CC100: ogs_sbi_xact_remove (context.c:2674)
==90==    by 0x407DDDC: smf_sbi_discover_and_send (sbi-path.c:392)
```

Fix:

Now the function follows proper resource ownership semantics:
the caller who creates the transaction is responsible for cleanup
when the function fails, making the error handling consistent and
preventing double-free issues.

Added missing cleanup to ogs_sbi_send_request_to_nf_instance and
af_sbi_discover_and_send.
2026-01-31 20:17:58 +09:00
..
af-sm.c [POOL] refactor memory in HTTP server (#3196) 2024-06-30 22:03:13 +09:00
af-sm.h Move src/../nf-sm.[ch] to lib/sbi/nf-sm.[ch] 2022-08-12 14:03:53 +09:00
context.c [SBI] Generate URI via HTTP.location as is (#3058) 2024-04-18 21:24:07 +09:00
context.h [SBI] Generate URI via HTTP.location as is (#3058) 2024-04-18 21:24:07 +09:00
event.c Added Service-based NF discovery 2022-09-02 23:04:57 +09:00
event.h SCP(Model D) is now the default setting. 2022-10-22 11:26:04 +09:00
init.c Typos Fix 2025-04-19 20:45:25 +09:00
init.h Move src/../nf-sm.[ch] to lib/sbi/nf-sm.[ch] 2022-08-12 14:03:53 +09:00
local.c Added Service-based NF discovery 2022-09-02 23:04:57 +09:00
local.h [SBI] Support service-names in discovery option 2022-08-27 00:12:22 +09:00
meson.build Move src/../nf-sm.[ch] to lib/sbi/nf-sm.[ch] 2022-08-12 14:03:53 +09:00
nbsf-build.c SCP(Model D) is now the default setting. 2022-10-22 11:26:04 +09:00
nbsf-build.h [5GC] Added BSF(Binding Support Function) 2021-05-29 15:56:12 +09:00
nbsf-handler.c [SEPP] Initial Update for 5G Roaming (#2739) 2023-11-19 19:34:51 +09:00
nbsf-handler.h [5GC] Added BSF(Binding Support Function) 2021-05-29 15:56:12 +09:00
nnrf-handler.c [SBI] SearchResult.validityPeriod 3600->30s (#3210) 2024-05-17 14:54:32 +09:00
nnrf-handler.h Move src/../nf-sm.[ch] to lib/sbi/nf-sm.[ch] 2022-08-12 14:03:53 +09:00
npcf-build.c [all] allow value of 0 for S-NSSAI SST 2025-01-11 20:22:46 +09:00
npcf-build.h VoNR added but not tested! 2021-11-14 21:07:56 +09:00
npcf-handler.c [DBI] Improve YAML policy config by adding SUPI range filtering 2025-02-05 21:56:15 +09:00
npcf-handler.h VoNR added but not tested! 2021-11-14 21:07:56 +09:00
sbi-path.c [SBI] Fix double-free 2026-01-31 20:17:58 +09:00
sbi-path.h SCP(Model D) is now the default setting. 2022-10-22 11:26:04 +09:00