Opened 3 years ago
Closed 12 months ago
#10342 closed defect (fixed)
memory leak in fftools/ffmpeg_opt.c file's opt_map_channel function
| Reported by: | Hripsime | Owned by: | |
|---|---|---|---|
| Priority: | important | Component: | ffmpeg |
| Version: | git-master | Keywords: | memory leak |
| Cc: | Hripsime | Blocked By: | |
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
The opt_map_channel function in the fftools/ffmpeg_opt.c source file appears to contain a memory leak. Specifically, memory is allocated using av_strdup() in line 472:
mapchan = av_strdup(arg);
However, the function contains multiple exit_program() calls that terminate the program without freeing the allocated memory in lines 507, 513, 519, and 533.
Change History (4)
comment:1 by , 3 years ago
| Analyzed by developer: | unset |
|---|---|
| Reproduced by developer: | unset |
| Resolution: | → invalid |
| Status: | new → closed |
comment:2 by , 3 years ago
All the memory is freed by the operating system.
*modern operating system. And anyway, GPU memory will not be, handles will not be closed, even files opened will not be closed. And of course it makes closing slower, since OS will still check the state before closing the threads.
comment:3 by , 3 years ago
| Resolution: | invalid |
|---|---|
| Status: | closed → reopened |
It's important to cleanup resources manually so we can detect if there is any memleak in our libs.
Should be fixed by http://ffmpeg.org/pipermail/ffmpeg-devel/2023-May/309209.html
comment:4 by , 12 months ago
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
Fixed in 2654347d7adba61ab8a8cce470d657958f6f00f9.
(And the whole affected code was later removed in e48055fdceceab3aed09b0f82299bc3fbbb94b54.)



Exiting without freeing all memory is not a leak. All the memory is freed by the operating system.