Page MenuHomeFreeBSD

Fix a memory leak in libiberty
ClosedPublic

Authored by trix_juniper.net on Feb 20 2017, 5:06 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 7, 4:27 PM
Unknown Object (File)
Sun, Apr 7, 1:36 PM
Unknown Object (File)
Sun, Apr 7, 7:53 AM
Unknown Object (File)
Mar 13 2024, 5:24 PM
Unknown Object (File)
Feb 7 2024, 11:49 AM
Unknown Object (File)
Jan 9 2024, 10:22 PM
Unknown Object (File)
Dec 23 2023, 9:30 PM
Unknown Object (File)
Dec 19 2023, 1:25 PM
Subscribers

Details

Summary

The function make_relative_prefix_1 does not properly free locally allocated memory when it returns early.

Free the memory associated with the variables full_programe, bin_dirs, prog_dirs, and prefix_dirs when the
function returns early.

Test Plan

Run clang's static analyzer, scan-build, before to reproduce the problem; run scan-build after to show problem is resolved.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

trix_juniper.net retitled this revision from to Fix a memory leak in libiberty.
trix_juniper.net updated this object.
trix_juniper.net edited the test plan for this revision. (Show Details)
trix_juniper.net set the repository for this revision to rS FreeBSD src repository - subversion.
This revision is now accepted and ready to land.May 30 2017, 8:32 PM

Thanks!
Now if someone could commit it..
Tom

contrib/binutils/libiberty/make-relative-prefix.c
302 ↗(On Diff #25435)

These if statements should really use the style of the file.

if (prog_dirs == NULL)
  {
    free (full_progname);

...etc.

Note the opening/closing braces on their own lines 2 space indented, with the rest of the block an additional 2 space indented.

@stevek will you commit (with style fix)?

@stevek will you commit (with style fix)?

Sure, I can do that.

This revision was automatically updated to reflect the committed changes.