[Pkg-octave-devel] Bug#541433: Bug#541433: octave-sockets: memory leak

Thomas Weber thomas.weber.mail at gmail.com
Sun Aug 16 18:14:43 UTC 2009


On Fri, Aug 14, 2009 at 08:22:37AM +0200, Paul Sundvall wrote:
> Package: octave-sockets
> Version: 1.0.4-3
> Severity: important
> 
> There are two memory leaks in sockets.cc 
> The first one is a new[] which is paired with delete and not delete[].
> The second one has a new[] but no delete[].
> 
> I suggest a patch which is attached.

I will forward your patch upstream, but one question, see below:


> --- sockets.cc.debian-1.0.4-3	2009-08-14 08:11:38.000000000 +0200
> +++ sockets.cc	2009-08-14 08:14:23.000000000 +0200
> @@ -528,7 +528,7 @@ DEFUN_DLD(send,args,nargout, \
>      for ( int i = 0 ; i < d1.length() ; i++ )
>        buf[i] = (unsigned char)d1(i);
>      retval = ::send( s->get_sock_fd(), (const char*)buf, data.byte_size(), 0 );
> -    delete buf;
> +    delete[] buf;
>    }
>    else
>    {
> @@ -543,7 +543,8 @@ DEFUN_DLD(send,args,nargout, \
>  // function to receive data over a socket
>  DEFUN_DLD(recv,args,nargout, \
>  	  "recv(octave_socket,int)\nSee the send() man pages.  This will only allow the" \
> -	  " user to receive uint8 arrays or strings")
> +	  " user to receive uint8 arrays or strings" \
> +"\n pauls version")

Do you really want this "pauls version" to be part of the diff?

	Thomas





More information about the Pkg-octave-devel mailing list