summaryrefslogtreecommitdiffstats
path: root/source/lib/util_file.c
Commit message (Collapse)AuthorAgeFilesLines
* r23659: file_pload is not used outside of util_file.cVolker Lendecke2007-06-291-1/+1
|
* r20179: Sync up with Samba4 - remove blank lines at theJeremy Allison2006-12-151-3/+9
| | | | | end parsing a file. Jeremy.
* r19798: reducing some diffs...bringing over ntlm_auth changesGerald Carter2006-11-191-236/+1
|
* r15005: Fix printf args to remove warnings.Jeremy Allison2006-04-091-3/+3
| | | | Jeremy.
* r15003: patch based on code from Arkady Glabek <aglabek@centeris.com> to ↵Gerald Carter2006-04-081-0/+20
| | | | ensure that global memory is freed when unloading pam_winbind.so (needs more testing on non-linux platforms)
* r13915: Fixed a very interesting class of realloc() bugs found by Coverity.Jeremy Allison2006-03-071-14/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* r13316: Let the carnage begin....Gerald Carter2006-02-031-13/+20
| | | | Sync with trunk as off r13315
* r12043: It's amazing the warnings you find when compiling on a 64-bitJeremy Allison2005-12-031-1/+1
| | | | | | | | | | | box with gcc4 and -O6... Fix a bunch of C99 dereferencing type-punned pointer will break strict-aliasing rules errors. Also added prs_int32 (not uint32...) as it's needed in one place. Find places where prs_uint32 was being used to marshall/unmarshall a time_t (a big no no on 64-bits). More warning fixes to come. Thanks to Volker for nudging me to compile like this. Jeremy.
* r4088: Get medieval on our ass about malloc.... :-). Take control of all our ↵Jeremy Allison2004-12-071-5/+5
| | | | | | | | | allocation functions so we can funnel through some well known functions. Should help greatly with malloc checking. HEAD patch to follow. Jeremy.
* r2155: Reformat, plus steal from Samba4 :-).Jeremy Allison2004-09-011-233/+259
| | | | | | | | | | | | | | | tridge: the lp_use_mmap() in map_file() is inappropriate for 2 reasons, so I have removed it. - lp_use_mmap() is really meant to cope with systems that have broken mmap coherence, but map_file() doesn't need coherence, as its maps read only - map_file() is used to map the charset files before loadparm has loaded, so lp_use_mmap() is always returning false for the major use of map_file() Jeremy.
* r2: import HEAD into svn+ssh://svn.samba.org/home/svn/samba/trunkCVS Import User2004-04-041-0/+606
metze