From e5ce904ddbd6175ba86ed827bf096b76b11b5511 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 3 Dec 2004 06:42:06 +0000 Subject: r4054: got rid of Realloc(), replacing it with the type safe macro realloc_p() (This used to be commit b0f6e21481745d1b2ced28d9ed6f09f6ffd99562) --- source4/ntvfs/common/brlock.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'source4/ntvfs/common') diff --git a/source4/ntvfs/common/brlock.c b/source4/ntvfs/common/brlock.c index e01f458e74..7b351f77b0 100644 --- a/source4/ntvfs/common/brlock.c +++ b/source4/ntvfs/common/brlock.c @@ -229,9 +229,8 @@ NTSTATUS brl_lock(struct brl_context *brl, void *notify_ptr) { TDB_DATA kbuf, dbuf; - int count, i; - struct lock_struct lock, *locks; - char *tp; + int count=0, i; + struct lock_struct lock, *locks=NULL; NTSTATUS status; kbuf.dptr = (char *)file_key->data; @@ -279,14 +278,14 @@ NTSTATUS brl_lock(struct brl_context *brl, } /* no conflicts - add it to the list of locks */ - tp = Realloc(dbuf.dptr, dbuf.dsize + sizeof(*locks)); - if (!tp) { + locks = realloc_p(locks, struct lock_struct, count+1); + if (!locks) { status = NT_STATUS_NO_MEMORY; goto fail; } else { - dbuf.dptr = tp; + dbuf.dptr = (char *)locks; } - memcpy(dbuf.dptr + dbuf.dsize, &lock, sizeof(lock)); + locks[count] = lock; dbuf.dsize += sizeof(lock); if (tdb_store(brl->w->tdb, kbuf, dbuf, TDB_REPLACE) != 0) { -- cgit