[PR #1206] [MERGED] [FIX] Fix minor memory leak in OCR code #2000

Open
opened 2026-01-29 17:19:42 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/1206
Author: @kdrag0n
Created: 1/21/2020
Status: Merged
Merged: 1/21/2020
Merged by: @cfsmp3

Base: masterHead: ocr-leak-fix


📝 Commits (2)

  • 13fd5b7 ocr: Fix minor memory leak
  • ad04814 changes: Document OCR memory leak fix

📊 Changes

2 files changed (+2 additions, -0 deletions)

View changed files

📝 docs/CHANGES.TXT (+1 -0)
📝 src/lib_ccx/ocr.c (+1 -0)

📄 Description

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.
  • I have mentioned this change in the changelog.

My familiarity with the project is as follows (check one):

  • I absolutely love CCExtractor, but have not contributed previously.

This leak was detected by Valgrind:

==1203168== 2,880 bytes in 57 blocks are definitely lost in loss record 3 of 4
==1203168==    at 0x483877F: malloc (vg_replace_malloc.c:309)
==1203168==    by 0x51ADBEE: strdup (in /usr/lib/libc-2.30.so)
==1203168==    by 0x24D1F8: ocr_bitmap (ocr.c:569)
==1203168==    by 0x24E25B: ocr_rect (ocr.c:907)
==1203168==    by 0x284832: write_dvb_sub (dvb_subtitle_decoder.c:1665)
==1203168==    by 0x284B7A: dvbsub_handle_display_segment (dvb_subtitle_decoder.c:1720)
==1203168==    by 0x285024: dvbsub_decode (dvb_subtitle_decoder.c:1828)
==1203168==    by 0x2406AF: process_data (general_loop.c:648)
==1203168==    by 0x2416D0: general_loop (general_loop.c:1025)
==1203168==    by 0x1AC89A: api_start (ccextractor.c:214)
==1203168==    by 0x16EC03: main (ccextractor.c:536)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/CCExtractor/ccextractor/pull/1206 **Author:** [@kdrag0n](https://github.com/kdrag0n) **Created:** 1/21/2020 **Status:** ✅ Merged **Merged:** 1/21/2020 **Merged by:** [@cfsmp3](https://github.com/cfsmp3) **Base:** `master` ← **Head:** `ocr-leak-fix` --- ### 📝 Commits (2) - [`13fd5b7`](https://github.com/CCExtractor/ccextractor/commit/13fd5b748f7d945ae1abe0484520cc00ab6eaa9d) ocr: Fix minor memory leak - [`ad04814`](https://github.com/CCExtractor/ccextractor/commit/ad048147921d5d5896ccb8ed1494e8418a01c2fa) changes: Document OCR memory leak fix ### 📊 Changes **2 files changed** (+2 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/CHANGES.TXT` (+1 -0) 📝 `src/lib_ccx/ocr.c` (+1 -0) </details> ### 📄 Description **In raising this pull request, I confirm the following (please check boxes):** - [x] I have read and understood the [contributors guide](https://github.com/CCExtractor/ccextractor/blob/master/.github/CONTRIBUTING.md). - [x] I have checked that another pull request for this purpose does not exist. - [x] I have considered, and confirmed that this submission will be valuable to others. - [x] I accept that this submission may not be used, and the pull request closed at the will of the maintainer. - [x] I give this submission freely, and claim no ownership to its content. - [x] **I have mentioned this change in the [changelog](https://github.com/CCExtractor/ccextractor/blob/master/docs/CHANGES.TXT).** **My familiarity with the project is as follows (check one):** - [x] I absolutely love CCExtractor, but have not contributed previously. --- This leak was detected by Valgrind: ``` ==1203168== 2,880 bytes in 57 blocks are definitely lost in loss record 3 of 4 ==1203168== at 0x483877F: malloc (vg_replace_malloc.c:309) ==1203168== by 0x51ADBEE: strdup (in /usr/lib/libc-2.30.so) ==1203168== by 0x24D1F8: ocr_bitmap (ocr.c:569) ==1203168== by 0x24E25B: ocr_rect (ocr.c:907) ==1203168== by 0x284832: write_dvb_sub (dvb_subtitle_decoder.c:1665) ==1203168== by 0x284B7A: dvbsub_handle_display_segment (dvb_subtitle_decoder.c:1720) ==1203168== by 0x285024: dvbsub_decode (dvb_subtitle_decoder.c:1828) ==1203168== by 0x2406AF: process_data (general_loop.c:648) ==1203168== by 0x2416D0: general_loop (general_loop.c:1025) ==1203168== by 0x1AC89A: api_start (ccextractor.c:214) ==1203168== by 0x16EC03: main (ccextractor.c:536) ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 17:19:42 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2000