mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-02-03 21:23:48 +00:00
[PR #1105] [MERGED] [FIX] Fix several memory leaks using Leptonica API for hardcoded subtitle extraction #1897
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/CCExtractor/ccextractor/pull/1105
Author: @dbarelop
Created: 9/9/2019
Status: ✅ Merged
Merged: 9/12/2019
Merged by: @cfsmp3
Base:
master← Head:master📝 Commits (6)
5346475Rewritten Tesseract and Leptonica importsf79d87fFixed memory leak extracting hardcoded subtitlesc1c32a2Minor code enhancements and cleanupse88bea7Fixed memory leak using function pixSauvolaBinarize3d6bd56Updated changelog41fd3ebMerge branch 'master' into master📊 Changes
10 files changed (+189 additions, -146 deletions)
View changed files
📝
docs/CHANGES.TXT(+1 -0)📝
src/lib_ccx/hardsubx.c(+2 -2)📝
src/lib_ccx/hardsubx.h(+4 -4)📝
src/lib_ccx/hardsubx_classifier.c(+1 -1)📝
src/lib_ccx/hardsubx_decoder.c(+172 -133)📝
src/lib_ccx/hardsubx_imgops.c(+1 -1)📝
src/lib_ccx/hardsubx_utility.c(+1 -1)📝
src/lib_ccx/ocr.c(+2 -2)📝
src/lib_ccx/params.c(+2 -2)📝
src/lib_ccx/utility.h(+3 -0)📄 Description
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
Leptonica functions in
hardsubx_decoder.csuch aspixConvertRGBToGray,pixSobelEdgeFilter,pixDilateGrayorpixThresholdToBinaryallocate a new Pix struct everytime they are called, rather than modifying the one passed as an argument.This leads to a memory leak everytime the functions
_process_frame_white_basic,_process_frame_color_basic,_display_frameor_process_frame_tickertextare called, which happens at every frame of the input video and results in a huge memory consumption, even for a video the size of a few hundred MBs.The proposed fix keeps track of all the created Pix structs and destroys them properly after each call to the mentioned functions. Library inclusions for Leptonica and Tesseract libraries have also been modified to look up the standard include directories.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.