Skip to content

Commit

Permalink
Fix potential double free in link.c (#456)
Browse files Browse the repository at this point in the history
* Fix potential double free in link.c

* Fix unittest

* Add link_attach_succeeds

* Add double-free test

* Fix return value in unit test function

* Address CR comments

* Fix unit tests
  • Loading branch information
ewertons committed Feb 9, 2024
1 parent e02272b commit 2ca42b6
Show file tree
Hide file tree
Showing 5 changed files with 509 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/link.c
Expand Up @@ -404,9 +404,9 @@ static void link_frame_received(void* context, AMQP_VALUE performative, uint32_t
}
}
}
}

flow_destroy(flow_handle);
flow_destroy(flow_handle);
}
}
else if (is_transfer_type_by_descriptor(descriptor))
{
Expand Down
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Expand Up @@ -13,6 +13,7 @@ add_subdirectory(cbs_ut)
add_subdirectory(connection_ut)
add_subdirectory(frame_codec_ut)
add_subdirectory(header_detect_io_ut)
add_subdirectory(link_ut)
add_subdirectory(message_ut)
add_subdirectory(sasl_anonymous_ut)
add_subdirectory(sasl_frame_codec_ut)
Expand Down
18 changes: 18 additions & 0 deletions tests/link_ut/CMakeLists.txt
@@ -0,0 +1,18 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.

set(theseTestsName link_ut)
set(${theseTestsName}_test_files
${theseTestsName}.c
)

set(${theseTestsName}_c_files
../../src/link.c
)

set(${theseTestsName}_h_files
)

build_c_test_artifacts(${theseTestsName} ON "tests/uamqp_tests")

compile_c_test_artifacts_as(${theseTestsName} C99)

0 comments on commit 2ca42b6

Please sign in to comment.