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);