[En-Nut-Discussion] PPP Bug Fix (potential)

Brett Abbott Brett.Abbott at digital-telemetry.com
Thu Jun 7 11:42:16 CEST 2007


Hi all.

We're just upgrading to the latest nutos release and see that the ppp 
memory leak suggested last year may have not made it into the release.  
Is anyone able to advise if it was implemented in another way?  Details 
below (original post included for reference).

static int NutPppClose(NUTFILE * fp)
{
   PPPDCB *dcb = fp->nf_dev->dev_dcb;

   IpcpClose(fp->nf_dev);
   if (dcb->dcb_user)
       NutHeapFree(dcb->dcb_user);
   if (dcb->dcb_pass)
       NutHeapFree(dcb->dcb_pass);

   // Add _close of uart?
   if(dcb->dcb_fd)
       _close(dcb->dcb_fd); // Added This line to close uart device?
   // End of change

  NutHeapFree(fp);

   return 0;
}


Many thanks in advance from down under.
Brett

-------- Original Message --------
Subject: 	[En-Nut-Discussion] PPP - Should NutPPPClose() also close the 
uart device?
Date: 	Tue, 24 Oct 2006 22:52:02 +1300
From: 	Brett Abbott <Brett.Abbott at digital-telemetry.com>
Reply-To: 	Ethernut User Chat (English) <en-nut-discussion at egnite.de>
To: 	Ethernut User Chat (English) <en-nut-discussion at egnite.de>



Hi

NutPPPOpen starts by opening the uart device using _open() however 
NutPPPClose() does not close the uart device, leaving the uart file lost 
in memory (unless Im meant to delete it elsewhere - oops).

Does anyone have an opinion on how best to address this? Perhaps by 
adding a friendly close prior to the NutHeapFree(fp) in NutPppClose?

Many Thanks in advance
Brett

static int NutPppClose(NUTFILE * fp)
{
   PPPDCB *dcb = fp->nf_dev->dev_dcb;

   IpcpClose(fp->nf_dev);
   if (dcb->dcb_user)
       NutHeapFree(dcb->dcb_user);
   if (dcb->dcb_pass)
       NutHeapFree(dcb->dcb_pass);

   // Add _close of uart?
   if(dcb->dcb_fd)
       _close(dcb->dcb_fd); // Added This line to close uart device?
   // End of change

  NutHeapFree(fp);

   return 0;
}

-- 
-----------------------------------------------------------------
Brett Abbott, Managing Director, Digital Telemetry Limited
Email: Brett.Abbott at digital-telemetry.com
PO Box 24 036 Manners Street, Wellington, New Zealand
Phone +64 (4) 5666-860  Mobile +64 (21) 656-144
------------------- Commercial in confidence --------------------


_______________________________________________
En-Nut-Discussion mailing list
En-Nut-Discussion at egnite.de
http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion




-- 
-----------------------------------------------------------------
Brett Abbott, Managing Director, Digital Telemetry Limited
Email: Brett.Abbott at digital-telemetry.com
PO Box 24 036 Manners Street, Wellington, New Zealand
Phone +64 (4) 462-3439  Mobile +64 (21) 656-144
------------------- Commercial in confidence --------------------





More information about the En-Nut-Discussion mailing list