Bug 199670 - [patch] memory leak in netpfil
Summary: [patch] memory leak in netpfil
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-net (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2015-04-24 17:42 UTC by Pedro F. Giffuni
Modified: 2015-04-27 05:45 UTC (History)
2 users (show)

See Also:


Attachments
Fix (379 bytes, patch)
2015-04-24 17:42 UTC, Pedro F. Giffuni
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro F. Giffuni freebsd_committer freebsd_triage 2015-04-24 17:42:57 UTC
Created attachment 155950 [details]
Fix

Found by clang static analyzer:
http://scan.freebsd.org/scan-build/WORLD/2015-04-20-amd64/report-ee9ce2.html#EndPath

And also Coverity (CID 1245771).

I cannot really check this so hopefully someone else can review.
Comment 1 Andrey V. Elsukov freebsd_committer freebsd_triage 2015-04-24 20:18:00 UTC
It looks like you need to free r->alink too.
Comment 2 Pedro F. Giffuni freebsd_committer freebsd_triage 2015-04-27 02:00:03 UTC
(In reply to Andrey V. Elsukov from comment #1)

I may be missing something r->alink[0] is NULL, so I think the freeing the array will do nothing.
Comment 3 commit-hook freebsd_committer freebsd_triage 2015-04-27 05:44:25 UTC
A commit references this bug:

Author: glebius
Date: Mon Apr 27 05:44:10 UTC 2015
New revision: 282051
URL: https://svnweb.freebsd.org/changeset/base/282051

Log:
  Fix memory leak.

  PR:		199670
  Reviewed by:	ae

Changes:
  head/sys/netpfil/ipfw/ip_fw_nat.c