From 53baa544708663cac1de4c6dd2c9fd6764b84518 Mon Sep 17 00:00:00 2001 From: Georg Hopp Date: Tue, 20 Aug 2013 14:00:43 +0100 Subject: [PATCH] add quick fit to cbuf --- include/cbuf.h | 2 ++ src/cbuf/cbuf.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/cbuf.h b/include/cbuf.h index dd2de94..12f1da8 100644 --- a/include/cbuf.h +++ b/include/cbuf.h @@ -38,11 +38,13 @@ #include "stream.h" #include "commons.h" +#include "utils/memory.h" #define ECBUFOVFL 100 CLASS(Cbuf) { + struct memSegment * shm_name_seg; char * shm_name; // shared memory identifier char * data; diff --git a/src/cbuf/cbuf.c b/src/cbuf/cbuf.c index 0ee216d..dfed914 100644 --- a/src/cbuf/cbuf.c +++ b/src/cbuf/cbuf.c @@ -53,7 +53,8 @@ cbufCtor(void * _this, va_list * params) int shm; char * data; - this->shm_name = malloc(strlen(shm_name) + 7 + 2); + this->shm_name_seg = memMalloc(strlen(shm_name) + 7 + 2); + this->shm_name = this->shm_name_seg->ptr; sprintf(this->shm_name, "/%06d_%s", getpid(), shm_name); /** @@ -110,7 +111,7 @@ cbufDtor(void * _this) { Cbuf this = _this; - FREE(this->shm_name); + MEM_FREE(this->shm_name_seg); if (NULL != this->data && MAP_FAILED != this->data) { munmap(this->data, this->bsize << 1);