Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
If we call pool_alloc() on a NULL pool, bomb out with an error.
[rsync/rsync.git]
/
lib
/
pool_alloc.c
diff --git
a/lib/pool_alloc.c
b/lib/pool_alloc.c
index
acb356a
..
4c93ea1
100644
(file)
--- a/
lib/pool_alloc.c
+++ b/
lib/pool_alloc.c
@@
-85,11
+85,17
@@
pool_destroy(alloc_pool_t p)
free(pool);
}
free(pool);
}
-void *pool_alloc(alloc_pool_t p, size_t len, char *bomb)
+void *
+pool_alloc(alloc_pool_t p, size_t len, char *bomb)
{
struct alloc_pool *pool = (struct alloc_pool *) p;
if (!pool)
{
struct alloc_pool *pool = (struct alloc_pool *) p;
if (!pool)
- return NULL;
+ {
+ char *msg;
+ if (asprintf(&msg, "pool_alloc(%s) on NULL pool", bomb) > 0)
+ bomb = msg;
+ goto bomb;
+ }
if (!len)
len = pool->quantum;
if (!len)
len = pool->quantum;
@@
-287,11
+293,8
@@
pool_stats(alloc_pool_t p, int fd, int summarize)
strcpy(buf, " FREE BOUND\n");
write(fd, buf, strlen(buf));
strcpy(buf, " FREE BOUND\n");
write(fd, buf, strlen(buf));
- cur = pool->free;
- while (cur)
+ for (cur = pool->free; cur; cur = cur->next)
{
FDEXTSTAT(cur);
{
FDEXTSTAT(cur);
- cur = cur->next;
}
}
}
}
-