summaryrefslogtreecommitdiff
path: root/source4/ntvfs
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-12-03 06:42:06 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:06:19 -0500
commite5ce904ddbd6175ba86ed827bf096b76b11b5511 (patch)
tree722b04d001e9b26bb47b2480fef13699a0366667 /source4/ntvfs
parent7dcfd94f817d1c12a14704cbb96604dc3074aa2e (diff)
downloadsamba-e5ce904ddbd6175ba86ed827bf096b76b11b5511.tar.gz
samba-e5ce904ddbd6175ba86ed827bf096b76b11b5511.tar.bz2
samba-e5ce904ddbd6175ba86ed827bf096b76b11b5511.zip
r4054: got rid of Realloc(), replacing it with the type safe macro realloc_p()
(This used to be commit b0f6e21481745d1b2ced28d9ed6f09f6ffd99562)
Diffstat (limited to 'source4/ntvfs')
-rw-r--r--source4/ntvfs/common/brlock.c13
1 files changed, 6 insertions, 7 deletions
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) {