This is the mail archive of the
gsl-discuss@sourceware.org
mailing list for the GSL project.
Re: free
- From: "Brian Gough" <bjg at network-theory dot co dot uk>
- To: GSL Discussion <gsl-discuss at sources dot redhat dot com>
- Cc: GSL <help-gsl at gnu dot org>
- Date: Mon, 12 Jun 2006 16:20:45 +0100
- Subject: Re: free
- Newsgroups: GSL, Discussion, <gsl-discuss@sources.redhat.com>
- References: <4958.165.91.115.246.1149968330.squirrel@neoweb.tamu.edu><448BC36B.9020405@btinternet.com><9e3becawi2.fsf@doze.jochen-kuepper.de><448C3875.6030506@btinternet.com><9e7j3nactq.fsf_-_@doze.jochen-kuepper.de><448C5EDC.7050301@btinternet.com><9e4pyra58i.fsf_-_@doze.jochen-kuepper.de>
Jochen Küpper writes:
> > I checked the source code for gsl_matrix_free and it will fail if passed
> > a null pointer.
>
> Shouldn't the GSL free-routines be changed like the following patch?
My thinking on that was that for most people calling the free()
functions on a null pointer is usually an error rather than by design,
so it's helpful to get a segmentation fault.
In general, I've never been convinced that free'ing a null pointer is
particularly useful as opposed to just doing "if (p) free(p)" in the
application.
--
Brian Gough