diff options
author | Dmitri Pal <dpal@redhat.com> | 2010-06-10 11:53:54 -0400 |
---|---|---|
committer | Dmitri Pal <dpal@redhat.com> | 2010-08-10 12:51:31 -0400 |
commit | 098e8d8fba3d77fe206b51e0b28ef63aff060989 (patch) | |
tree | 4224c14343ccca140ee5df201dfe6fe95e58fa99 | |
parent | a1f9fb18c7a21adfe3f65064fcc4886bbfb388ea (diff) | |
download | sssd-098e8d8fba3d77fe206b51e0b28ef63aff060989.tar.gz sssd-098e8d8fba3d77fe206b51e0b28ef63aff060989.tar.xz sssd-098e8d8fba3d77fe206b51e0b28ef63aff060989.zip |
[REFARRAY] Fixing the cleaup code
It turned out that the array cleanup was assuming
that the data always requires cleanup.
In case of array of numbers it is a false assumtion.
-rw-r--r-- | common/refarray/ref_array.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/common/refarray/ref_array.c b/common/refarray/ref_array.c index d02f9ae..a571804 100644 --- a/common/refarray/ref_array.c +++ b/common/refarray/ref_array.c @@ -341,8 +341,9 @@ int ref_array_replace(struct ref_array *ra, } /* Clear old element */ - ra->cb((unsigned char *)(ra->storage) + idx * ra->elsize, - REF_ARRAY_DELETE, ra->cb_data); + if (ra->cb) + ra->cb((unsigned char *)(ra->storage) + idx * ra->elsize, + REF_ARRAY_DELETE, ra->cb_data); /* Overwrite element */ memcpy((unsigned char *)(ra->storage) + idx * ra->elsize, @@ -375,8 +376,9 @@ int ref_array_remove(struct ref_array *ra, } /* Clear old element */ - ra->cb((unsigned char *)(ra->storage) + idx * ra->elsize, - REF_ARRAY_DELETE, ra->cb_data); + if (ra->cb) + ra->cb((unsigned char *)(ra->storage) + idx * ra->elsize, + REF_ARRAY_DELETE, ra->cb_data); /* Shift elements left */ for (i = idx + 1; i < ra->len; i++) { |