diff options
author | jamie <jamie@FreeBSD.org> | 2009-04-30 22:43:21 +0000 |
---|---|---|
committer | jamie <jamie@FreeBSD.org> | 2009-04-30 22:43:21 +0000 |
commit | d462264a61048da50ccb5ab1ed29191f5a2e0a2f (patch) | |
tree | 853aa4f3d03a6b300f8b296a0273de282f22160f | |
parent | 90f2d4d25829782c76ed811c8c669e49c8e4ae2e (diff) | |
download | FreeBSD-src-d462264a61048da50ccb5ab1ed29191f5a2e0a2f.zip FreeBSD-src-d462264a61048da50ccb5ab1ed29191f5a2e0a2f.tar.gz |
Don't call the OSD destructor if the data slot is NULL
(since it's already not done on unused slots, which are indistinguishable
to the caller).
Approved by: bz (mentor)
-rw-r--r-- | sys/kern/kern_osd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/kern_osd.c b/sys/kern/kern_osd.c index 0aed19d..1cb83e4 100644 --- a/sys/kern/kern_osd.c +++ b/sys/kern/kern_osd.c @@ -297,8 +297,10 @@ do_osd_del(u_int type, struct osd *osd, u_int slot, int list_locked) OSD_DEBUG("Slot doesn't exist (type=%u, slot=%u).", type, slot); return; } - osd_destructors[type][slot - 1](osd->osd_slots[slot - 1]); - osd->osd_slots[slot - 1] = NULL; + if (osd->osd_slots[slot - 1] != NULL) { + osd_destructors[type][slot - 1](osd->osd_slots[slot - 1]); + osd->osd_slots[slot - 1] = NULL; + } for (i = osd->osd_nslots - 1; i >= 0; i--) { if (osd->osd_slots[i] != NULL) { OSD_DEBUG("Slot still has a value (type=%u, slot=%u).", |