summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2009-07-30 00:32:08 +0200
committerThomas Hellstrom <thellstrom@vmware.com>2009-08-17 17:03:59 +0200
commitb29a24d07c136192c7144d6aeacbd4c977ff6c0b (patch)
tree7c3279772742555801cd91c73af6377d5967dc85
parenta5dc3a32f56f7f42e3286be287921c24fbea7fc7 (diff)
userpool: check wsbmBufStorageInit returned value
-rw-r--r--src/wsbm_userpool.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/wsbm_userpool.c b/src/wsbm_userpool.c
index f7833b7..c8fb95b 100644
--- a/src/wsbm_userpool.c
+++ b/src/wsbm_userpool.c
@@ -206,11 +206,15 @@ pool_create(struct _WsbmBufferPool *pool,
{
struct _WsbmUserPool *p = containerOf(pool, struct _WsbmUserPool, pool);
struct _WsbmUserBuffer *vBuf = calloc(1, sizeof(*vBuf));
+ int ret;
if (!vBuf)
return NULL;
- wsbmBufStorageInit(&vBuf->buf, pool);
+ ret = wsbmBufStorageInit(&vBuf->buf, pool);
+ if (ret)
+ goto out_err;
+
vBuf->sysmem = NULL;
vBuf->proposedPlacement = placement;
vBuf->size = size;
@@ -264,6 +268,7 @@ pool_create(struct _WsbmBufferPool *pool,
if (vBuf->sysmem != NULL
|| (!(vBuf->kBuf.placement & WSBM_PL_FLAG_SYSTEM)))
return &vBuf->buf;
+
out_err:
free(vBuf);
return NULL;