Memory leak found during investigation of logic pertaining to xio_retrieveoptions.
Fix could be 2 lines. Instead, approach chosen to mimic pattern found in other files using parallel logic, such as tlsio_mbedts.c and tlsio_openssl.c
Because OptionHandler_AddOption mallocs memory for the option-value being added (in this case underlying_io_options), which has already been allocated once by xio_retrieveoptions, the memory must be destroyed if OptionHandler_AddOption succeeds.
Memory leak found during investigation of logic pertaining to
xio_retrieveoptions
. Fix could be 2 lines. Instead, approach chosen to mimic pattern found in other files using parallel logic, such astlsio_mbedts.c
andtlsio_openssl.c
Because
OptionHandler_AddOption
mallocs memory for the option-value being added (in this caseunderlying_io_options
), which has already been allocated once byxio_retrieveoptions
, the memory must be destroyed ifOptionHandler_AddOption
succeeds.