X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Frespool.c;h=64f9a2fc643f14abcbf7d85edbabdb8643aba8a2;hb=31316f76dd68a03b803f51931d6e1fff2c60c5d1;hp=a4978fdf51ad030ff323cd00aa2b3336acd9d951;hpb=623185a65b8870abb82cd0dd8547a1aa4fc1f535;p=libucw.git diff --git a/ucw/respool.c b/ucw/respool.c index a4978fdf..64f9a2fc 100644 --- a/ucw/respool.c +++ b/ucw/respool.c @@ -99,8 +99,7 @@ struct resource * res_alloc(const struct res_class *rc) { struct respool *rp = rp_current(); - if (!rp) - return NULL; + ASSERT(rp); uns size = (rc->res_size ? : sizeof(struct resource)); struct resource *r = (rp->mpool ? mp_alloc_fast(rp->mpool, size) : xmalloc(size)); @@ -121,6 +120,8 @@ res_drop(struct resource *r) void res_detach(struct resource *r) { + if (!r) + return; if (r->rclass->detach) r->rclass->detach(r); res_drop(r); @@ -129,6 +130,8 @@ res_detach(struct resource *r) void res_free(struct resource *r) { + if (!r) + return; if (r->rclass->free) r->rclass->free(r); res_drop(r);