Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | "Joachim Schmitz" <nospam.jojo@schmitz-digital.de> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Competing criteria |
| Date | 2011-10-23 11:06 +0200 |
| Organization | 1&1 Internet AG |
| Message-ID | <j80lfs$htk$1@online.de> (permalink) |
| References | (2 earlier) <e216a71kb5i68vtaas07l9sgprnoh1lgs4@4ax.com> <j7va52$dkp$1@dont-email.me> <j7vcpl$qe5$1@news.albasani.net> <j7vfkc$goj$1@dont-email.me> <4ea3d072$0$1384$4fafbaef@reader2.news.tin.it> |
io_x wrote: > "Richard Damon" <news.x.richarddamon@xoxy.net> ha scritto nel > messaggio news:j7vfkc$goj$1@dont-email.me... >> On 10/22/11 5:33 PM, Ark wrote: >> The rule I always use is a task is not allowed to fail, then it >> can't call on anything that might fail. malloc, in general, has the >> possibility to fail so needs to be avoided in tasks that can not >> fail. free() is actually always safe, as free can never fail, and can >> never cause another malloc to fail. > > i think some free() function can fail in the wrost way Indeed free() can fail if cou give something not NULL which hasn't come from malloc(), calloc() or realloc() or had been free()'d already, in which case undefined behavoir occurs (and free() doesn't have means to report an error) From a Linux man-page: free() frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc(), calloc() or realloc(). Otherwise, or if free(ptr) has already been called before, undefined behaviour occurs. If ptr is NULL, no operation is performed. Bye, Jojo
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Competing criteria nroberts <roberts.noah@gmail.com> - 2011-10-21 14:49 -0700
Re: Competing criteria Seebs <usenet-nospam@seebs.net> - 2011-10-21 22:16 +0000
Re: Competing criteria Roberto Waltman <usenet@rwaltman.com> - 2011-10-22 14:06 -0400
Re: Competing criteria Richard Damon <news.x.richarddamon@xoxy.net> - 2011-10-22 16:47 -0400
Re: Competing criteria Ark <akhasin@macroexpressions.com> - 2011-10-22 17:33 -0400
Re: Competing criteria Richard Damon <news.x.richarddamon@xoxy.net> - 2011-10-22 18:20 -0400
Re: Competing criteria Ark <akhasin@macroexpressions.com> - 2011-10-22 21:29 -0400
Re: Competing criteria "io_x" <a@b.c.invalid> - 2011-10-23 10:32 +0200
Re: Competing criteria "Joachim Schmitz" <nospam.jojo@schmitz-digital.de> - 2011-10-23 11:06 +0200
Re: Competing criteria Willem <willem@toad.stack.nl> - 2011-10-23 09:09 +0000
Re: Competing criteria "io_x" <a@b.c.invalid> - 2011-10-23 12:04 +0200
Re: Competing criteria "io_x" <a@b.c.invalid> - 2011-10-27 08:44 +0200
Re: Competing criteria Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-10-23 05:01 -0700
Re: Competing criteria Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-10-23 08:29 -0400
Re: Competing criteria Richard Damon <news.x.richarddamon@xoxy.net> - 2011-10-23 09:15 -0400
Re: Competing criteria Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-10-23 06:24 -0700
Re: Competing criteria Markus Wichmann <nullplan@gmx.net> - 2011-10-24 22:39 +0200
Re: Competing criteria Keith Thompson <kst-u@mib.org> - 2011-10-24 17:10 -0700
Re: Competing criteria Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-10-25 13:09 +0300
Re: Competing criteria Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-10-26 00:23 -0700
Re: Competing criteria Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-10-23 00:02 +0300
Re: Competing criteria Seebs <usenet-nospam@seebs.net> - 2011-10-24 20:10 +0000
Re: Competing criteria Richard Damon <news.x.richarddamon@xoxy.net> - 2011-10-24 19:36 -0400
Re: Competing criteria nroberts <roberts.noah@gmail.com> - 2011-10-25 10:07 -0700
Re: Competing criteria Richard Damon <news.x.richarddamon@xoxy.net> - 2011-10-25 16:51 -0400
Re: Competing criteria John Gordon <gordon@panix.com> - 2011-10-21 22:37 +0000
Re: Competing criteria Richard Damon <news.x.richarddamon@xoxy.net> - 2011-10-21 20:42 -0400
csiph-web