summaryrefslogtreecommitdiffstats
path: root/source/locking/brlock.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2001-08-12 17:30:01 +0000
committerSimo Sorce <idra@samba.org>2001-08-12 17:30:01 +0000
commitfa8e55b8b465114ce209344965c1ca0333b84db9 (patch)
treef0e4646dc69b270cbdcf1147ff911182669afbc7 /source/locking/brlock.c
parent895d1cd317d0838d711474f2f19186444a88b52c (diff)
downloadsamba-fa8e55b8b465114ce209344965c1ca0333b84db9.tar.gz
samba-fa8e55b8b465114ce209344965c1ca0333b84db9.tar.xz
samba-fa8e55b8b465114ce209344965c1ca0333b84db9.zip
this is a big global fix for the ptr = Realloc(ptr, size) bug.
many possible mem leaks, and segfaults fixed. someone should port this fix to 2.2 also.
Diffstat (limited to 'source/locking/brlock.c')
-rw-r--r--source/locking/brlock.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/locking/brlock.c b/source/locking/brlock.c
index 1982d9982c2..d22297a9488 100644
--- a/source/locking/brlock.c
+++ b/source/locking/brlock.c
@@ -218,6 +218,7 @@ BOOL brl_lock(SMB_DEV_T dev, SMB_INO_T ino, int fnum,
TDB_DATA kbuf, dbuf;
int count, i;
struct lock_struct lock, *locks;
+ char *tp;
kbuf = locking_key(dev,ino);
@@ -246,8 +247,9 @@ BOOL brl_lock(SMB_DEV_T dev, SMB_INO_T ino, int fnum,
}
/* no conflicts - add it to the list of locks */
- dbuf.dptr = Realloc(dbuf.dptr, dbuf.dsize + sizeof(*locks));
- if (!dbuf.dptr) goto fail;
+ tp = Realloc(dbuf.dptr, dbuf.dsize + sizeof(*locks));
+ if (!tp) goto fail;
+ else dbuf.dptr = tp;
memcpy(dbuf.dptr + dbuf.dsize, &lock, sizeof(lock));
dbuf.dsize += sizeof(lock);
tdb_store(tdb, kbuf, dbuf, TDB_REPLACE);