Skip to content

Commit

Permalink
Fix memory leak.
Browse files Browse the repository at this point in the history
Newer versions of iptables does not call iptc_free(), after
iptc_commit().  This is done to support several commits,
but we choose not to support this feature.  Thus, we need
to free memory here (used by the iptables ruleset, actually
the cached libiptc blob version), to avoid mem leak.

Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
  • Loading branch information
Jesper Dangaard Brouer committed Nov 30, 2011
1 parent 48285aa commit 88c9609
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions libiptc.xs
Expand Up @@ -96,9 +96,13 @@ commit(self)
SET_ERRSTR("%s", iptc_strerror(errno));
SvIOK_on(ERROR_SV);
}
// FIXME: Think its allowed to do several commits in newer
// versions of iptables, thus we should not set self=NULL
// self = NULL;
/* Newer versions of iptables does not call iptc_free(), after
iptc_commit(). This is done to support several commits,
but we choose not to support this feature. Thus, we need
to free memory here (used by the iptables ruleset, actually
the cached libiptc blob version).
*/
iptc_free(self);
# TODO: UnLock /var/lock/iptables_tablename
}
OUTPUT:
Expand Down

0 comments on commit 88c9609

Please sign in to comment.