Quantcast

regarding wrapper for free "u_free"

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

regarding wrapper for free "u_free"

Raveendra Reddy P
Hi, As it's a wrapper function, so i think it would be a good idea to mark the freed pointer to NULL.The advantages can be: 1. Dangling pointer usage can be caught, if any existing. 2. Unexpected behaviour due to double free can be eradicated. -- manual page for free says "if free(ptr) has already been called before, undefined behavior occurs. If ptr is NULL, no operation is performed." File Name: memory.c Path: src/lib/u/memory.c Function: u_free /** \brief Wrapper for free(3), sanity checks the supplied pointer */ void u_free (void *ptr) { if (ptr) { free(ptr); ptr = NULL; } }
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: regarding wrapper for free "u_free"

Klaus Kaempf
* Raveendra Reddy P <[hidden email]> [Apr 22. 2014 14:29]:
> Hi,As it's a wrapper function, so i think it would be a good idea to mark the
> freed pointer to NULL.

Agreed. Can you please enter this as an Openwsman issue at
https://github.com/Openwsman/openwsman/issues/new ?

Klaus
--
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: regarding wrapper for free "u_free"

Raveendra Reddy P
Hi Klaus, Done. Issue No.30 https://github.com/Openwsman/openwsman/issues/30 could you please share the procedure to submit this modification/patch. if you have any write-up.
Loading...