[Asterisk-code-review] test_abstract_jb.c: Fix put and put_out_of_order memory leaks. (asterisk[18])
Sean Bright
asteriskteam at digium.com
Wed Sep 8 14:33:29 CDT 2021
Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/16451 )
Change subject: test_abstract_jb.c: Fix put and put_out_of_order memory leaks.
......................................................................
test_abstract_jb.c: Fix put and put_out_of_order memory leaks.
We can't rely on RAII_VAR(...) to properly clean up data that is
allocated within a loop.
ASTERISK-27176 #close
Change-Id: Ib575616101230c4f603519114ec62ebf3936882c
---
M tests/test_abstract_jb.c
1 file changed, 8 insertions(+), 7 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/51/16451/1
diff --git a/tests/test_abstract_jb.c b/tests/test_abstract_jb.c
index 53614bc..af0c04b 100644
--- a/tests/test_abstract_jb.c
+++ b/tests/test_abstract_jb.c
@@ -293,8 +293,8 @@
RAII_VAR(struct ast_jb *, jb, &default_jb, dispose_jitterbuffer); \
const struct ast_jb_impl *impl; \
struct ast_jb_conf conf; \
- RAII_VAR(struct ast_frame *, expected_frame, NULL, ast_frame_dtor); \
- RAII_VAR(struct ast_frame *, actual_frame, NULL, ast_frame_dtor); \
+ struct ast_frame *expected_frame = NULL; \
+ struct ast_frame *actual_frame = NULL; \
int res; \
long next; \
int i; \
@@ -341,8 +341,8 @@
return AST_TEST_FAIL; \
} \
VERIFY_FRAME(actual_frame, expected_frame); \
- ast_frfree(expected_frame); \
- expected_frame = NULL; \
+ ast_frame_dtor(expected_frame); \
+ ast_frame_dtor(actual_frame); \
} \
return AST_TEST_PASS; \
}
@@ -427,8 +427,8 @@
RAII_VAR(struct ast_jb *, jb, &default_jb, dispose_jitterbuffer); \
const struct ast_jb_impl *impl; \
struct ast_jb_conf conf; \
- RAII_VAR(struct ast_frame *, actual_frame, NULL, ast_frame_dtor); \
- RAII_VAR(struct ast_frame *, expected_frame, NULL, ast_frame_dtor); \
+ struct ast_frame *expected_frame = NULL; \
+ struct ast_frame *actual_frame = NULL; \
int res; \
long next; \
int i; \
@@ -483,7 +483,8 @@
return AST_TEST_FAIL; \
} \
VERIFY_FRAME(actual_frame, expected_frame); \
- ast_frfree(expected_frame); \
+ ast_frame_dtor(expected_frame); \
+ ast_frame_dtor(actual_frame); \
expected_frame = NULL; \
} \
\
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16451
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: Ib575616101230c4f603519114ec62ebf3936882c
Gerrit-Change-Number: 16451
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean at seanbright.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210908/907d3f0a/attachment.html>
More information about the asterisk-code-review
mailing list