#9 Memory leaking

Bugs
closed-fixed
Code (11)
9
2001-02-16
2000-11-13
Anonymous
No

Memory leaks dramatically!
Doesn't depend on amount of data served. It leaks memory
on a rate of 20 kb per second consumig 3% of CPU (pentium
II 400 mhz).

Discussion

  • Friedrich Seifert

    Hi,

    I've discovered the same problem, but it seems that I've managed to fix it. The bug is in nfsd.c. On nearly each call ftranslate() allocates a new buffer for the filename and returns the pointer to it. But nfsd_nfsproc_translate_look up_2(), which calls ftranslate() doesn't free the buffer. Adding a free(test_argp.name) helps. Some care must be taken since in few cases ftranslate() returns the original name, that must not be freed.

    Here is the patch:
    --- nfsd.c.old Tue Nov 14 09:04:51 2000
    +++ nfsd.c Mon Nov 20 13:38:47 2000
    @@ -578,6 +578,9 @@
    memcpy( rqstp, &test_rqstp, sizeof( struct svc_req ));
    memcpy( argp, &test_argp, sizeof( test_argp ));
    return status;
    + } else {
    + if (test_argp.name != argp->name)
    + free(test_argp.name);
    }

    }

    Happy hacking,
    Friedrich

     
  • Friedrich Seifert

    Hi,

    I've discovered the same problem, but it seems that I've managed to fix it. The bug is in nfsd.c. On nearly each call ftranslate() allocates a new buffer for the filename and returns the pointer to it. But nfsd_nfsproc_translate_look up_2(), which calls ftranslate() doesn't free the buffer. Adding a free(test_argp.name) helps. Some care must be taken since in few cases ftranslate() returns the original name, that must not be freed.

    Here is the patch:
    --- nfsd.c.old Tue Nov 14 09:04:51 2000
    +++ nfsd.c Mon Nov 20 13:38:47 2000
    @@ -578,6 +578,9 @@
    memcpy( rqstp, &test_rqstp, sizeof( struct svc_req ));
    memcpy( argp, &test_argp, sizeof( test_argp ));
    return status;
    + } else {
    + if (test_argp.name != argp->name)
    + free(test_argp.name);
    }

    }

    Happy hacking,
    Friedrich

     
  • Gregory Warnes

    Gregory Warnes - 2001-02-16

    Fixed in release 0.91 using patch submitted by Friedrich Seifert.

     
  • Gregory Warnes

    Gregory Warnes - 2001-02-16
    • priority: 5 --> 9
    • assigned_to: nobody --> warnes
    • status: open --> closed-fixed
     

Log in to post a comment.