Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

21 byte memory leak in merge_styles (3 tiny leaks of 7 bytes) #430

Closed
Quipyowert2 opened this issue Feb 14, 2021 · 1 comment · Fixed by #431 or #441
Closed

21 byte memory leak in merge_styles (3 tiny leaks of 7 bytes) #430

Quipyowert2 opened this issue Feb 14, 2021 · 1 comment · Fixed by #431 or #441
Assignees
Labels
type:bug Something's broken!
Milestone

Comments

@Quipyowert2
Copy link
Contributor

Quipyowert2 commented Feb 14, 2021

Thanks for reporting your bug here! The following template will help with
giving as much information as possible so that it's easier to diagnose and
fix.

Upfront Information

Please provide the following information by running the command and providing
the output.

  • Fvwm3 version (run: fvwm3 --version)
    4405437
fvwm3 1.0.3 (1.0.2-48-g356e327f)
with support for:  ReadLine, XPM, PNG, Shape, XShm, SM, Bidi text, XRandR, XRender, XCursor, XFT, NLS
  • Linux distribution or BSD name/version
    openSUSE 15.2 running on Windows Subsystem for Linux.
  • Platform (run: uname -sp)
    Linux x86_64

Expected Behaviour

Ideally no memory leaks reported by Valgrind
What were you trying to do? Please explain the problem.
Running valgrind on fvwm3 to find any more memory leaks to fix.

Actual Behaviour

merge_styles_leak.log

What should have happened, but didn't?

Enabling logging

fvwm3 has a means of logging what it's doing. Enabling this when
reproducing the issue might help. To do this, either change the means fvwm3
is started by adding -v as in:

fvwm3 -v

or, once fvwm3 has loaded, send SIGUSR2 as in:

pkill -USR2 fvwm3

The resulting logfile can be found in $HOME/.fvwm/fvwm3-output.log

Steps to Reproduce

How can the problem be reproduced?

  1. Compile fvwm3 revision 4405437
  2. valgrind --leak-check=full --track-origins=no --undef-value-errors=no --fullpath-after=$PWD/ --num-callers=200 --suppressions=fontconfig.supp fvwm/fvwm3 |& less
  3. When Fvwm3 loads, click the background and click Quit then click Quit again from the confirmation dialog that pops up.
    For this, the following is helpful:
  • Reduce the problem to the smallest fvwm configuration example (where
    possible). Start with a blank config file (fvwm3 -f/dev/null) and go from
    there.

  • Does the problem also happen with Fvwm2?

Include your configuration with this issue.
My fvwm config is the default fvwm3 config with this line added from a bugreport somewhere (I think from PR #429):
*FvwmIconMan*action Mouse 1 N sendcommand "Iconify off", sendcommand "FlipFocus", sendcommand "Raise"

Does Fvwm3 crash?

Yes, it crashed several times when I was adding in the free_style calls but seems to be fine now.

If fvwm3 crashes then check your system for a corefile. This is platform
dependant, however, check if:

  • corefiles are enabled (ulimit -c)
  • A corefile might be in $HOME or /tmp/.
  • If you're using Linux (with systemd), check coredumpctl list.
    coredumpctl may need installing separately.

If you find a corefile, install gdb and run:

gdb /path/to/fvwm3 /path/to/corefile

If you're using coredumpctl then use:

coredumpctl debug

Then from within the (gdb) prompt, issue:

bt full

... and include the output here.

Extra Information

  • Anything else we should know?
    X server: VcXsrv 1.20.8.1

  • Feel free to take a screen capture or video and upload to this issue if you
    feel it would help.

  • Attach $HOME/.fvwm/fvwm3-output.log from the step above.
    fvwm3-output.log

Fontconfig error suppression file (fontconfig.supp in the above Valgrind command):

{
   Fontconfig suppression
   Memcheck:Leak
   match-leak-kinds: definite
   fun:malloc
   ...
   obj:/usr/lib64/libfontconfig.so.1.10.1
   ...
}
{
   Fontconfig suppression 2
   Memcheck:Leak
   match-leak-kinds: definite
   fun:realloc
   ...
   obj:/usr/lib64/libfontconfig.so.1.10.1
   ...
}
@Quipyowert2 Quipyowert2 added the type:bug Something's broken! label Feb 14, 2021
Quipyowert2 added a commit to Quipyowert2/fvwm3 that referenced this issue Feb 14, 2021
merge_styles allocated a small amount of memory using strdup(). This
memory wasn't being freed by the callers. I had to change
do_free_src_and_alloc_copy argument of merge_styles to True in
lookup_style() to get free_style() to stop crashing.

Fixes fvwmorg#430.
Quipyowert2 added a commit to Quipyowert2/fvwm3 that referenced this issue Feb 14, 2021
merge_styles allocated a small amount of memory using strdup(). This
memory wasn't being freed by the callers. I had to change
do_free_src_and_alloc_copy argument of merge_styles to True in
lookup_style() to get free_style() to stop crashing.

Fixes fvwmorg#430.
ThomasAdam pushed a commit that referenced this issue Feb 17, 2021
merge_styles allocated a small amount of memory using strdup(). This
memory wasn't being freed by the callers. I had to change
do_free_src_and_alloc_copy argument of merge_styles to True in
lookup_style() to get free_style() to stop crashing.

Fixes #430.
@ThomasAdam ThomasAdam reopened this Feb 19, 2021
@ThomasAdam
Copy link
Member

ThomasAdam commented Feb 19, 2021

Hi @Quipyowert2

This is causing problems at the moment, and I've reverted the original commit in this PR until the remaining issues can be addressed. See: https://www.mail-archive.com/[email protected]/msg04902.html

Can you take a look?

@ThomasAdam ThomasAdam added this to the 1.0.3 milestone Feb 19, 2021
Quipyowert2 added a commit to Quipyowert2/fvwm3 that referenced this issue Feb 22, 2021
requested.

do_free_src_and_alloc_copy wasn't being checked for the placement
position, the initial map command, the title format, and the icon title
format.

Fixes fvwmorg#430.
Quipyowert2 added a commit to Quipyowert2/fvwm3 that referenced this issue Feb 22, 2021
do_free_src_and_alloc_copy wasn't being checked for the placement
position, the initial map command, the title format, and the icon title
format.

Fixes fvwmorg#430.
ThomasAdam pushed a commit that referenced this issue Feb 24, 2021
do_free_src_and_alloc_copy wasn't being checked for the placement
position, the initial map command, the title format, and the icon title
format.

Fixes #430.
@ThomasAdam ThomasAdam moved this to Done in FVWM3 Sep 18, 2022
@ThomasAdam ThomasAdam added this to FVWM3 Sep 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something's broken!
Projects
Status: Done
2 participants