summaryrefslogtreecommitdiff
path: root/src/pad.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pad.c')
-rw-r--r--src/pad.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/pad.c b/src/pad.c
index e7a1ad4..48186d3 100644
--- a/src/pad.c
+++ b/src/pad.c
@@ -196,18 +196,20 @@ void pad_reset(pad_t *pad)
/* Free a pad and it's associated allocations. */
-void pad_free(pad_t *pad)
+pad_t * pad_free(pad_t *pad)
{
- chunk_t *chunk, *_chunk;
+ if (pad) {
+ chunk_t *chunk, *_chunk;
- assert(pad);
+ pad_reset(pad);
- pad_reset(pad);
+ list_for_each_entry_safe(chunk, _chunk, &pad->free_chunks, chunks)
+ free(chunk);
- list_for_each_entry_safe(chunk, _chunk, &pad->free_chunks, chunks)
- free(chunk);
+ free(pad);
+ }
- free(pad);
+ return NULL;
}
© All Rights Reserved