Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Andriy T. Yanko <wireless@wireless.org.ua>
To: netfilter@lists.netfilter.org
Subject: libipfwc memory leak?
Date: Tue, 24 Sep 2002 09:11:21 +0300	[thread overview]
Message-ID: <20020924091121.44aae61d.wireless@wireless.org.ua> (raw)

Hi people!

I know that this letter is not for this mailllist. But I'm tired to find mistake.

I just writen this smal code for example:

--- cut ---
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#include "libipfwc/libipfwc.h"


int main( int argc, char **argv)
{
    pid_t pid;

    unsigned int num_chains; 
    unsigned int num_rules; 
    static struct ipfwc_fwchain *chains;
    struct ipfwc_fwrule *rules;

    pid=fork();
    if ( pid == -1 ) { printf("Can't fork!\n"); exit(0); }
    if ( pid != 0) exit(0);
    setsid();

    while(1)
    {
	chains=ipfwc_get_chainnames(&num_chains); 
	rules=ipfwc_get_rules(&num_rules,0); 
	sleep(1);
    }
    
    return 0;
}
--- end ---

When program is runnig I just type command "ps aux" 
and I saw that my program get more and more system memory.

Is this memory leak of libipfwc library?

In  libipfwc.c  function ipfwc_get_chainnames & ipfwc_get_rules use malloc() but not use free().
It's maybe ok for program ipchains but in my case is not gut.

How to fix it?

THANKS IN ADVANCE.


-- 
Andriy T. Yanko
wireless@wireless.org.ua

* Avoid The Gates of Hell use Linux


             reply	other threads:[~2002-09-24  6:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-24  6:11 Andriy T. Yanko [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-09-23 14:39 libipfwc memory leak? Andriy T. Yanko
2002-09-27 20:44 ` Anders Fugmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020924091121.44aae61d.wireless@wireless.org.ua \
    --to=wireless@wireless.org.ua \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox