summaryrefslogtreecommitdiff
path: root/nscd/mem.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-06-12 04:52:39 +0000
committerUlrich Drepper <drepper@redhat.com>2008-06-12 04:52:39 +0000
commit9ad58cc3ba614e13af5a6f3810f9b115899eb2ca (patch)
tree4c9eb1babf38f281adcc2cf80d08dbf7b648930d /nscd/mem.c
parentc128355211141f304e9257dc6d16b73ab57a1fd0 (diff)
* nscd/mem.c (gc): Initialize obstack earlier so that if we jump
out we don't use uninitialized memory. * nscd/hstcache.c (cache_addhst): Send correct number of bytes to the client.
Diffstat (limited to 'nscd/mem.c')
-rw-r--r--nscd/mem.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/nscd/mem.c b/nscd/mem.c
index 96ff03f0df..e821729dab 100644
--- a/nscd/mem.c
+++ b/nscd/mem.c
@@ -235,6 +235,11 @@ gc (struct database_dyn *db)
/* Sort the entries by their address. */
qsort (he, cnt, sizeof (struct hashentry *), sort_he);
+#define obstack_chunk_alloc xmalloc
+#define obstack_chunk_free free
+ struct obstack ob;
+ obstack_init (&ob);
+
/* Determine the highest used address. */
size_t high = nmark;
while (high > 0 && mark[high - 1] == 0)
@@ -307,10 +312,6 @@ gc (struct database_dyn *db)
size_t size;
struct moveinfo *next;
} *moves = NULL;
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
- struct obstack ob;
- obstack_init (&ob);
while (byte < high)
{