Your message dated Sat, 12 Apr 2008 12:46:43 +0200
with message-id <[EMAIL PROTECTED]>
and subject line Re: Bug#417852: libnet-rawip-perl: memory leak
has caused the Debian Bug report #417852,
regarding libnet-rawip-perl: memory leak
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [EMAIL PROTECTED]
immediately.)


-- 
417852: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=417852
Debian Bug Tracking System
Contact [EMAIL PROTECTED] with problems
--- Begin Message ---
Package: libnet-rawip-perl
Version: 0.20-1
Severity: important
Tags: patch

Hi,

host_to_ip() has a memory leak of a few bytes; when a script sends stuff 
intensively
over the course of a few hours this means Perl hits the 4GB memory limit and 
everything
dies. The patch below is trivial, and seems to fix the issue for us.

--- libnet-rawip-perl-0.20.orig/util.c
+++ libnet-rawip-perl-0.20/util.c
@@ -116,8 +116,7 @@
 host_to_ip (char *host_name)
 {
   struct hostent *target;
-  u_long *resolved_ip;
-  resolved_ip = (u_long *) malloc (sizeof (u_long));
+  u_long resolved_ip;
 
   if ((target = gethostbyname (host_name)) == NULL)
     {
@@ -125,8 +124,8 @@
     }
   else
     {
-      bcopy (target->h_addr, resolved_ip, sizeof (struct in_addr));
-      return ntohl ((u_long) * resolved_ip);
+      memcpy((char *)&resolved_ip, target->h_addr, sizeof (struct in_addr));
+      return ntohl (resolved_ip);
     }
 }


-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.20.4
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8)


--- End Message ---
--- Begin Message ---
Hello Steinar

On 2008-04-07 Steinar H. Gunderson wrote:
> On Thu, Apr 05, 2007 at 10:40:11PM +0200, Christian Hammers wrote:
> >> host_to_ip() has a memory leak of a few bytes; when a script sends stuff
> >> intensively over the course of a few hours this means Perl hits the 4GB
> >> memory limit and everything dies. The patch below is trivial, and seems
> >> to fix the issue for us.
> > Thanks for the patch, I've asked the upstream author if it's correct and
> > will include it if he does not object.
> 
> Hi,
> 
> Any progress on this bug? I need libnet-rawip-perl for an event that's held
> once a year, and it was a bit odd to crash into the same leak this year as
> the last one :-)
> 
> http://pr0n.sesse.net/tg08/?fullscreen=1#304 has a nice image of our
> server's memory usage with an unpatched libnet-rawip-perl =)
> 
> /* Steinar */

The latest version in unstable, 0.23-2, should have the bug fixed as it
frees the pointer:

        host_to_ip (char *host_name)
        {
          struct hostent *target;
          u_long *resolved_ip;
          u_long host_resolved_ip; 
          resolved_ip = (u_long *) malloc (sizeof (u_long));
        
          if ((target = gethostbyname (host_name)) == NULL)
            { 
              croak("host_to_ip: failed");
            }
          else
            { 
              bcopy (target->h_addr, resolved_ip, sizeof (struct in_addr));
              host_resolved_ip = ntohl ((u_long) * resolved_ip);
  -->         free(resolved_ip);
              return host_resolved_ip;
            }
        }

If there's still a measurable memory leak, please reopen the bug.

bye,

-christian-

Attachment: signature.asc
Description: PGP signature


--- End Message ---

Reply via email to