Coding practices proposals

Sam Hartman hartmans at MIT.EDU
Thu Mar 17 18:48:19 EDT 2011


I've been thinking a bit more about freeing things in the cleanup
handler rather than sooner.
I wonder if that's overly restrictive.

My assumption is that you want it to be easy to make sure that the value
is freed. Here are some situations where  I'm not sure that makes sense:

* If you are using the iff-ladder style of cleanup and don't have gotos
  it seems reasonable to free and null sooner

* If a pointer is going out of scope it seems reasonable to free. I
  don't think we want to force things into top most scope just to clean
  them up in a particular place

* If the value has fairly short life, for example it is an intermediate
  used by one call.

--Sam



More information about the krbdev mailing list