diff options
Diffstat (limited to 'lib/resource.c')
-rw-r--r-- | lib/resource.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/resource.c b/lib/resource.c index bf4b3ae9..64f9a39c 100644 --- a/lib/resource.c +++ b/lib/resource.c @@ -157,13 +157,13 @@ rfree(void *res) { resource *r = res; - if (r) - { - if (r->n.next) - rem_node(&r->n); - r->class->free(r); - xfree(r); - } + if (!r) + return; + + if (r->n.next) + rem_node(&r->n); + r->class->free(r); + xfree(r); } /** @@ -408,6 +408,9 @@ mb_realloc(void *m, unsigned size) void mb_free(void *m) { + if (!m) + return; + struct mblock *b = SKIP_BACK(struct mblock, data, m); rfree(b); } |