On 03/30/2011 09:44 AM, Edward Shishkin wrote:
...
local->xattr = get_new_dict();
if (!local->xattr) {
op_errno = ENOMEM;
goto err;
}
if (dict_set_str(local->xattr,"trusted.glusterfs.lock","fubar")
!= 0) {
op_errno = EIO;
dict_unref(local->xattr);
goto err;
}
...
I found this incorrect: dict_unref decrements the refcount,
whereas get_new_dict didn't set it. If we really need refcounts,
I think we should use the pair (dict_new, dict_unref).
Otherwise,(get_new_dict, dict_destroy) will be enough.
That's probably correct. I remember going through some of the
get_new_dict/dict_new code, and I vaguely recall there was some reason I
used the former instead of the latter here, but I don't remember what
that reason was and the combination of get_new_dict/dict_unref could
well be invalid.