This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project iwhd.git.
The branch, dyn-providers-gc has been updated
via bdfba875f58988fc93e0c3bac3101eb2e0efd2a3 (commit)
from a1a2fcabde9e013118276484f5b64460d2ac35d7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/iwhd.git/commit/bdfba875f58988fc93e0c3bac3101eb2e0efd2a3
commit bdfba875f58988fc93e0c3bac3101eb2e0efd2a3
Author: Jim Meyering <meyering(a)redhat.com>
Date: Fri Jan 21 16:05:22 2011 +0100
don't pass NULL buffer to formatter in provider list generation
* rest.c (prov_list_generator): Pre-allocate a reasonably-large
buffer, rather than starting with a 0-length buffer and relying on
the ~doubling/realloc loop to make the buffer large enough.
diff --git a/rest.c b/rest.c
index 22d0d25..1fb1aa8 100644
--- a/rest.c
+++ b/rest.c
@@ -1637,6 +1637,14 @@ prov_list_generator (void *ctx, uint64_t pos, char *buf, size_t
max)
qsort (plist.buf, plist.n_used, sizeof *(plist.buf),
prov_name_compare);
+ // Use a size that is large enough to accommodate the
+ // result of formatting a few providers.
+ // Not important, as long as it's larger than 0.
+ ms->buf_n_alloc = 1024;
+ ms->buf = malloc (ms->buf_n_alloc);
+ if (ms->buf == NULL)
+ return -1;
+
// Emit all provider-related output into memory.
size_t i;
for (i = 0; i < plist.n_used; i++) {
-----------------------------------------------------------------------
Summary of changes:
rest.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
repo.or.cz automatic notification. Contact project admin jim(a)meyering.net
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
iwhd.git ("image warehouse daemon")