On Wed, 14 Apr 2010 10:48:28 +0400
Eugene Indenbom <eindenbom(a)gmail.com> wrote:
+ /* private data is allocated as top-level talloc context as
+ * it may need to survive for a while after main handle
destruction,
+ * see sdap_handle_data_lock/sdap_handle_data_release */
+ sh->private = talloc_zero(NULL, struct sdap_handle_data);
+ if (!sh->private) {
+ goto fail;
+ }
+
+ sh->private->sh = sh;
return sh;
+
Sorry Eugene, but I *really* do not like things like this.
- Allocating on NULL: very high risk of memory leaks
- Assigning sh to private->sh: very high risk of accessing free memory
if sh is freed before private is.
If preserving the handle is important I'd rather have a list of
handles, with old ones pushed down the list as soon as a connection is
marked bad so that they are not reused, but also not lost (memory wise).
--
Simo Sorce * Red Hat, Inc * New York