diff options
author | Lennart Poettering <lennart@poettering.net> | 2004-08-04 16:39:30 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2004-08-04 16:39:30 +0000 |
commit | 46091a9237f17f4295dca7140d8d70b4fce8b357 (patch) | |
tree | 1c600cd6e1801586abfb66d767f2cd96e15c819c /polyp/packet.c | |
parent | 24291aff27c671c11619684cb10d3b36fdf87c0d (diff) |
introduce pa_xmalloc() and friends
implement module auto loading
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@103 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/packet.c')
-rw-r--r-- | polyp/packet.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/polyp/packet.c b/polyp/packet.c index e94df057..955feeb1 100644 --- a/polyp/packet.c +++ b/polyp/packet.c @@ -27,13 +27,12 @@ #include <stdlib.h> #include "packet.h" +#include "xmalloc.h" struct pa_packet* pa_packet_new(size_t length) { struct pa_packet *p; assert(length); - p = malloc(sizeof(struct pa_packet)+length); - assert(p); - + p = pa_xmalloc(sizeof(struct pa_packet)+length); p->ref = 1; p->length = length; p->data = (uint8_t*) (p+1); @@ -44,9 +43,7 @@ struct pa_packet* pa_packet_new(size_t length) { struct pa_packet* pa_packet_new_dynamic(uint8_t* data, size_t length) { struct pa_packet *p; assert(data && length); - p = malloc(sizeof(struct pa_packet)); - assert(p); - + p = pa_xmalloc(sizeof(struct pa_packet)); p->ref = 1; p->length = length; p->data = data; @@ -66,7 +63,7 @@ void pa_packet_unref(struct pa_packet *p) { if (p->ref == 0) { if (p->type == PA_PACKET_DYNAMIC) - free(p->data); - free(p); + pa_xfree(p->data); + pa_xfree(p); } } |