Small fix for 'minimal'

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Small fix for 'minimal'

John Jannotti

The 'minimal' project in contrib was very helpful to get started with
lwip, but I believe there is a small bug.  In echo.c, in close_conn,
there is an attempt to pbuf_free(es->p) unconditionally.  but normally
p is null because es has nothing pending to send.  Here is my diff,
which corrects the same thing in another spot, and a cut and paste
error in a comment.

  jj


Index: echo.c
===================================================================
RCS file: /cvsroot/lwip/contrib/ports/unix/proj/minimal/echo.c,v
retrieving revision 1.2
diff -u -r1.2 echo.c
--- echo.c      1 May 2003 13:27:53 -0000       1.2
+++ echo.c      21 Sep 2005 20:42:57 -0000
@@ -46,7 +46,7 @@
   struct echo_state *es = arg;

   if (arg != NULL) {
-    pbuf_free(es->p);
+    if (es->p) pbuf_free(es->p);
     mem_free(arg);
   }
 }
@@ -60,7 +60,7 @@
   tcp_recv(pcb, NULL);
 #endif /* 0 */
   if (es != NULL) {
-    pbuf_free(es->p);
+    if (es->p) pbuf_free(es->p);
     mem_free(es);
   }
   tcp_close(pcb);
@@ -168,7 +168,7 @@
   tcp_arg(pcb, es);

   /* Tell TCP that we wish to be informed of incoming data by a call
-     to the http_recv() function. */
+     to the echo_recv() function. */
 #if 0
   tcp_recv(pcb, echo_recv);

zsh: exit 1     cvs diff -u


_______________________________________________
lwip-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

Re: Small fix for 'minimal'

Christiaan Simons
lwip-devel-bounces+christiaan.simons=[hidden email] wrote on 21-09-2005
22:44:32:

> The 'minimal' project in contrib was very helpful to get started with
> lwip, but I believe there is a small bug.

There is more than a small bug. There is a pbuf memory leak after about
1000+ small
echo's, and it seems larger files (>128 bytes (pbuf size)) aren't echo'd
properly.

Currently I'm rewriting the echo example, now using the true raw API
instead of the 'event API'.

> In echo.c, in close_conn,
> there is an attempt to pbuf_free(es->p) unconditionally.  but normally
> p is null because es has nothing pending to send.

Yep, found and fixed that a week ago in echo.c rev 1.4

>  Here is my diff,
> which corrects the same thing in another spot, and a cut and paste
> error in a comment.

Tnx anyway,

Christiaan Simons

Hardware / Software Engineer
Axon Digital Design

+31 (0)13 511 66 66
+31 (0)13 511 41 51

http://www.axon.tv



This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the system manager.
This message contains confidential information and is intended only for the
individual named.  If you are not the named addressee you should not
disseminate, distribute or copy this e-mail.



_______________________________________________
lwip-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

RE: Small fix for 'minimal'

Vinay Purohit
Christiaan,
I'm not familiar with the 'minimal' project. Do the memory leaks you
have mentioned also affect the 'regular' (for lack of a better term)
lwip stack?
Thanks
Vinay Purohit
Lucent Technologies


-----Original Message-----
From: lwip-devel-bounces+vpurohit=[hidden email]
[mailto:lwip-devel-bounces+vpurohit=[hidden email]] On Behalf Of
Christiaan Simons
Sent: Monday, October 24, 2005 6:42 AM
To: John Jannotti; lwip-devel
Subject: Re: [lwip-devel] Small fix for 'minimal'

lwip-devel-bounces+christiaan.simons=[hidden email] wrote on
21-09-2005
22:44:32:

> The 'minimal' project in contrib was very helpful to get started with
> lwip, but I believe there is a small bug.

There is more than a small bug. There is a pbuf memory leak after about
1000+ small
echo's, and it seems larger files (>128 bytes (pbuf size)) aren't echo'd
properly.

Currently I'm rewriting the echo example, now using the true raw API
instead of the 'event API'.

> In echo.c, in close_conn,
> there is an attempt to pbuf_free(es->p) unconditionally.  but normally
> p is null because es has nothing pending to send.

Yep, found and fixed that a week ago in echo.c rev 1.4

>  Here is my diff,
> which corrects the same thing in another spot, and a cut and paste
> error in a comment.

Tnx anyway,

Christiaan Simons

Hardware / Software Engineer
Axon Digital Design

+31 (0)13 511 66 66
+31 (0)13 511 41 51

http://www.axon.tv



This email and any files transmitted with it are confidential and
intended
solely for the use of the individual or entity to whom they are
addressed.
If you have received this email in error please notify the system
manager.
This message contains confidential information and is intended only for
the
individual named.  If you are not the named addressee you should not
disseminate, distribute or copy this e-mail.



_______________________________________________
lwip-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-devel



_______________________________________________
lwip-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

RE: Small fix for 'minimal'

Christiaan Simons


lwip-devel-bounces+christiaan.simons=[hidden email] wrote on 25-10-2005
17:37:30:

> I'm not familiar with the 'minimal' project. Do the memory leaks you
> have mentioned also affect the 'regular' (for lack of a better term)
> lwip stack?

No. We only found a problem in the contrib/ports/unix/proj/minimal example.
This 'echo' server application needs some fixing, it wasn't looked after
for a while.
It isn't a true part of the stack, it's a contrib project/module.

The current lwip 1.1.0 is stable IMHO.

Bye,

Christiaan Simons

Hardware / Software Engineer
Axon Digital Design

+31 (0)13 511 66 66
+31 (0)13 511 41 51

http://www.axon.tv


This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the system manager.
This message contains confidential information and is intended only for the
individual named.  If you are not the named addressee you should not
disseminate, distribute or copy this e-mail.



_______________________________________________
lwip-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-devel