Unit tests works. Pushed. Thanks!
On Friday 12 of April 2013 12:56:55 Martin Milata wrote:
Related to rhbz#951432.
Signed-off-by: Martin Milata mmilata@redhat.com
lib/cluster.c | 2 +- lib/strbuf.c | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/lib/cluster.c b/lib/cluster.c index e5825ee..75c9f61 100644 --- a/lib/cluster.c +++ b/lib/cluster.c @@ -76,7 +76,7 @@ cluster_add_index(struct cluster *cluster, int index) if (cluster->size >= cluster->alloced) { cluster->alloced = cluster->alloced >= 1 ? cluster->alloced * 2 : 1; - cluster->objects = realloc(cluster->objects, sizeof (*cluster->objects) + cluster->objects = sr_realloc(cluster->objects, sizeof (*cluster->objects) * cluster->alloced); } cluster->objects[cluster->size++] = index; diff --git a/lib/strbuf.c b/lib/strbuf.c index 27099c7..e051155 100644 --- a/lib/strbuf.c +++ b/lib/strbuf.c @@ -80,12 +80,7 @@ sr_strbuf_grow(struct sr_strbuf *strbuf, int num) while (strbuf->len + num + 1 > strbuf->alloc) strbuf->alloc *= 2; /* huge grow = infinite loop */
strbuf->buf = realloc(strbuf->buf, strbuf->alloc);
if (!strbuf->buf)
{
puts("Error while allocating memory for string buffer.");
exit(5);
}
}strbuf->buf = sr_realloc(strbuf->buf, strbuf->alloc);
}