Skip to content

Commit

Permalink
test: fix test_rtcp_decode_badmsg for OOM
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredh committed Jan 5, 2024
1 parent cdffbd0 commit adc1e77
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions test/rtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,17 +324,13 @@ int test_rtcp_decode_badmsg(void)
{
struct rtcp_msg *msg = NULL;
uint32_t ssrc = 0xcafebabe;
struct mbuf *mb;
int err = 0;

mb = mbuf_alloc(128);
if (!mb) {
err = ENOMEM;
goto out;
}
struct mbuf *mb = mbuf_alloc(128);
if (!mb)
return ENOMEM;

err = rtcp_encode(mb, RTCP_PSFB, RTCP_PSFB_SLI,
ssrc, ssrc, NULL, NULL);
int err = rtcp_encode(mb, RTCP_PSFB, RTCP_PSFB_SLI,
ssrc, ssrc, NULL, NULL);
if (err)
goto out;

Expand All @@ -344,7 +340,8 @@ int test_rtcp_decode_badmsg(void)

mb->pos = 0;

if (EBADMSG != rtcp_decode(&msg, mb)) {
int ret = rtcp_decode(&msg, mb);
if (EBADMSG != ret && ret != ENOMEM) {
err = EBADMSG;
goto out;
}
Expand Down

0 comments on commit adc1e77

Please sign in to comment.