All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: nlif_open() - nlif_close() - memory leak?
@ 2008-05-22 10:00 Anton
  2008-05-22 12:48 ` Eric Leblond
  0 siblings, 1 reply; 8+ messages in thread
From: Anton @ 2008-05-22 10:00 UTC (permalink / raw)
  To: Netfilter Mailinglist; +Cc: Eric Leblond

[-- Attachment #1: Type: text/plain, Size: 337 bytes --]


> The attached patch should fix the memory leak issue.
> Could you test it ?

Accordingly to "top", it's still leaking.

We used modified libnfnetlink-0.0.33/utils/iftest.c 
(attached)

THe following compile line was used:
gcc -o  iftest  iftest.c  -lnetfilter_queue -lnfnetlink

-------------------------------------------------------

[-- Attachment #2: iftest.c --]
[-- Type: text/x-csrc, Size: 646 bytes --]

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>

#include <libnfnetlink/libnfnetlink.h>

#include <signal.h>

static int TERM=0;

void sig_term(int s) {
 TERM=1;
}

int main() {
        int i;
        struct nlif_handle *h;

        signal(SIGTERM,sig_term);
        signal(SIGINT,sig_term);

         while(!TERM) {
            h = nlif_open();
            if (h == NULL) {
                perror("nlif_open");
                exit(EXIT_FAILURE);
            }

            nlif_query(h);
	    usleep(1000);
            nlif_close(h);
        }

        signal(SIGTERM,SIG_DFL);
        signal(SIGINT,SIG_DFL);

        puts("Bye");
}

^ permalink raw reply	[flat|nested] 8+ messages in thread
* nlif_open() - nlif_close() - memory leak?
@ 2008-05-22  5:53 Anton
  2008-05-22  7:43 ` Eric Leblond
  0 siblings, 1 reply; 8+ messages in thread
From: Anton @ 2008-05-22  5:53 UTC (permalink / raw)
  To: Netfilter Developer Mailing List

Hello!

Just doing some testuing of NFQUEUE, and noticed that in the 
simple case, if I do the following (yes, there is 
no "nlif_catch", but anyway) - I'm experiencing a memory 
leak for every open - close cycle?
Anything I'm missing?

       struct nlif_handle *h;
        h = nlif_open();
        if (h != NULL) {
         nlif_query(h);
         nfq_get_indev_name(h,tb,agg.iname);
         nfq_get_outdev_name(h,tb,agg.oname);
         nlif_close(h);
        }

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-05-22 14:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-22 10:00 nlif_open() - nlif_close() - memory leak? Anton
2008-05-22 12:48 ` Eric Leblond
2008-05-22 13:08   ` Pablo Neira Ayuso
2008-05-22 14:11     ` Eric Leblond
  -- strict thread matches above, loose matches on Subject: below --
2008-05-22  5:53 Anton
2008-05-22  7:43 ` Eric Leblond
2008-05-22  7:52   ` Anton
2008-05-22  8:07     ` Eric Leblond

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.