Bug 242967 - [patch] powerd free freqstr if sysctl fails
Summary: [patch] powerd free freqstr if sysctl fails
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.1-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: Mark Johnston
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-29 19:47 UTC by Hans Christian Woithe
Modified: 2020-01-02 14:41 UTC (History)
1 user (show)

See Also:


Attachments
patch to free freqstr if sysctl fails (485 bytes, patch)
2019-12-29 19:47 UTC, Hans Christian Woithe
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hans Christian Woithe 2019-12-29 19:47:25 UTC
Created attachment 210310 [details]
patch to free freqstr if sysctl fails

In the event that the (second) sysctl fails in read_freqs(), the memory allocated for freqstr is not freed before the function returns.  I've attached a patch to free the allocated memory before the function returns.
Comment 1 commit-hook freebsd_committer freebsd_triage 2019-12-29 20:58:15 UTC
A commit references this bug:

Author: markj
Date: Sun Dec 29 20:57:49 UTC 2019
New revision: 356184
URL: https://svnweb.freebsd.org/changeset/base/356184

Log:
  powerd(8): Fix a memory leak when we fail to read frequency levels.

  PR:		242967
  Submitted by:	Hans Christian Woithe <chwoithe@yahoo.com>
  MFC after:	3 days

Changes:
  head/usr.sbin/powerd/powerd.c
Comment 2 commit-hook freebsd_committer freebsd_triage 2020-01-02 14:39:46 UTC
A commit references this bug:

Author: markj
Date: Thu Jan  2 14:39:37 UTC 2020
New revision: 356272
URL: https://svnweb.freebsd.org/changeset/base/356272

Log:
  MFC r356184:
  powerd(8): Fix a memory leak when we fail to read frequency levels.

  PR:	242967

Changes:
_U  stable/12/
  stable/12/usr.sbin/powerd/powerd.c
Comment 3 Mark Johnston freebsd_committer freebsd_triage 2020-01-02 14:41:45 UTC
Thanks for the patch.