Age | Commit message (Collapse) | Author | Files | Lines |
|
* this allows VFS implementations that prefetch stat information on
readdir to return it through one VFS call
* backwards compatibility is maintained by passing in NULL
* if the system readdir doesn't return stat info, the stat struct is
set to invalid
|
|
bugs in various places whilst doing this (places that assumed
BOOL == int). I also need to fix the Samba4 pidl generation
(next checkin).
Jeremy.
(This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f)
|
|
(This used to be commit 87c91e4362c51819032bfbebbb273c52e203b227)
|
|
Jeremy.
(This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3)
|
|
clean up a bunch of no previous prototype warnings
(This used to be commit c60687db112405262adf26dbf267804b04074e67)
|
|
to do the upper layer directories but this is what
everyone is waiting for....
Jeremy.
(This used to be commit 9dafb7f48ca3e7af956b0a7d1720c2546fc4cfb8)
|
|
realloc can return NULL in one of two cases - (1) the realloc failed,
(2) realloc succeeded but the new size requested was zero, in which
case this is identical to a free() call.
The error paths dealing with these two cases should be different,
but mostly weren't. Secondly the standard idiom for dealing with
realloc when you know the new size is non-zero is the following :
tmp = realloc(p, size);
if (!tmp) {
SAFE_FREE(p);
return error;
} else {
p = tmp;
}
However, there were *many* *many* places in Samba where we were
using the old (broken) idiom of :
p = realloc(p, size)
if (!p) {
return error;
}
which will leak the memory pointed to by p on realloc fail.
This commit (hopefully) fixes all these cases by moving to
a standard idiom of :
p = SMB_REALLOC(p, size)
if (!p) {
return error;
}
Where if the realloc returns null due to the realloc failing
or size == 0 we *guarentee* that the storage pointed to by p
has been freed. This allows me to remove a lot of code that
was dealing with the standard (more verbose) method that required
a tmp pointer. This is almost always what you want. When a
realloc fails you never usually want the old memory, you
want to free it and get into your error processing asap.
For the 11 remaining cases where we really do need to keep the
old pointer I have invented the new macro SMB_REALLOC_KEEP_OLD_ON_ERROR,
which can be used as follows :
tmp = SMB_REALLOC_KEEP_OLD_ON_ERROR(p, size);
if (!tmp) {
SAFE_FREE(p);
return error;
} else {
p = tmp;
}
SMB_REALLOC_KEEP_OLD_ON_ERROR guarentees never to free the
pointer p, even on size == 0 or realloc fail. All this is
done by a hidden extra argument to Realloc(), BOOL free_old_on_error
which is set appropriately by the SMB_REALLOC and SMB_REALLOC_KEEP_OLD_ON_ERROR
macros (and their array counterparts).
It remains to be seen what this will do to our Coverity bug count :-).
Jeremy.
(This used to be commit 1d710d06a214f3f1740e80e0bffd6aab44aac2b0)
|
|
UNIX vendor
not understanding abstract data types :-(.
Jeremy.
(This used to be commit be5b4e2fa3ed30b0ff01b47d2354e5f782a12e25)
|
|
directory/insane app
problem. Rev vfs version. Doesn't change the normal codepath.
Jeremy.
(This used to be commit 0f03a6bdcdbdf60da81e0aeffa84ac6e48fc6a04)
|
|
module hooks seekdir, telldir, rewinddir to match updated large
directory code.
Jeremy.
(This used to be commit 0cdc62b60b6152cb67e517d70f4e4681dca8f4df)
|
|
Jeremy.
(This used to be commit fb7f1aff7c96e4672641f80b74a058abf25d0d6d)
|
|
allocation
functions so we can funnel through some well known functions. Should help greatly with
malloc checking.
HEAD patch to follow.
Jeremy.
(This used to be commit 620f2e608f70ba92f032720c031283d295c5c06a)
|
|
Jeremy.
(This used to be commit 3850f142c174034397451de8457564b9604113c5)
|
|
I'll add documentation to the Samba-Howto-Collection
metze
(This used to be commit 2bef5d2741807fe3f38a95710533520700e253a4)
|