Skip to content

Commit

Permalink
[mod_av] fix leak (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
seven1240 authored and andywolk committed Oct 23, 2021
1 parent 5243fbd commit 9727603
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/mod/applications/mod_av/avformat.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,7 @@ static void flush_video_pkt_queue(switch_queue_t *q)

while (switch_queue_trypop(q, (void **)&pkt) == SWITCH_STATUS_SUCCESS) {
av_packet_unref(pkt);
free(pkt);
}
}

Expand Down
9 changes: 6 additions & 3 deletions src/mod/applications/mod_av/test/test_avformat.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,18 @@ FST_CORE_BEGIN("conf")
status = switch_core_file_open(&fh, path, 1, 8000, flags, fst_pool);
fst_requires(status == SWITCH_STATUS_SUCCESS);
fst_requires(switch_test_flag(&fh, SWITCH_FILE_OPEN));
frame.data = data;
frame.packet = data;
frame.data = data + 12;
frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;

do {
frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE;
frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE - 12;
status = switch_core_file_read(&fh, data, &len);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "status: %d len: %d\n", status, (int)len);
fst_check(frame.img == NULL);
frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE;
frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE - 12;
status = switch_core_file_read_video(&fh, &frame, 0);
fst_check(frame.img == NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "status: %d len: %d %02x\n", status, frame.datalen, *(uint8_t *)frame.data);
} while (status == SWITCH_STATUS_MORE_DATA);

Expand Down

1 comment on commit 9727603

@andywolk
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.