summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2001-10-11 12:33:26 +0000
committerSimo Sorce <idra@samba.org>2001-10-11 12:33:26 +0000
commit49307c26789b3061780d160f4c6fa4863853eddd (patch)
treeda63221adcfa07ead7e7ec93b788a54b6c00c5bc
parent8edc45ec4c467e5069875808d0abd9452e7b056c (diff)
downloadsamba-49307c26789b3061780d160f4c6fa4863853eddd.tar.gz
samba-49307c26789b3061780d160f4c6fa4863853eddd.tar.bz2
samba-49307c26789b3061780d160f4c6fa4863853eddd.zip
remove unused function in mangle.c
fix some alloc leaks spotted by andreas moroder. (This used to be commit 39409a20f69078709c63f6f867c042e66d5c7de3)
-rw-r--r--source3/smbd/mangle.c12
-rw-r--r--source3/smbwrapper/shared.c13
-rw-r--r--source3/smbwrapper/smbw_dir.c2
3 files changed, 10 insertions, 17 deletions
diff --git a/source3/smbd/mangle.c b/source3/smbd/mangle.c
index a28cfe0931..7d8d68c9e2 100644
--- a/source3/smbd/mangle.c
+++ b/source3/smbd/mangle.c
@@ -1000,18 +1000,6 @@ BOOL name_map_mangle(char *OutName, BOOL need83, BOOL cache83, int snum)
static TDB_CONTEXT *mangle_tdb;
-static int POW10(unsigned int exp)
-{
- int result = 1;
-
- while (exp) {
- result *= 10;
- exp--;
- }
-
- return result;
-}
-
BOOL init_mangle_tdb(void)
{
char *tdbfile;
diff --git a/source3/smbwrapper/shared.c b/source3/smbwrapper/shared.c
index a10ef05bfc..90accbb503 100644
--- a/source3/smbwrapper/shared.c
+++ b/source3/smbwrapper/shared.c
@@ -104,6 +104,7 @@ char *smbw_getshared(const char *name)
{
int i;
struct stat st;
+ char *var;
lockit();
@@ -111,8 +112,9 @@ char *smbw_getshared(const char *name)
if (fstat(shared_fd, &st)) goto failed;
if (st.st_size != shared_size) {
- variables = (char *)Realloc(variables, st.st_size);
- if (!variables) goto failed;
+ var = (char *)Realloc(variables, st.st_size);
+ if (!var) goto failed;
+ else variables = var;
shared_size = st.st_size;
lseek(shared_fd, 0, SEEK_SET);
if (read(shared_fd, variables, shared_size) != shared_size) {
@@ -156,6 +158,7 @@ set a variable in the shared area
void smbw_setshared(const char *name, const char *val)
{
int l1, l2;
+ char *var;
/* we don't allow variable overwrite */
if (smbw_getshared(name)) return;
@@ -165,12 +168,14 @@ void smbw_setshared(const char *name, const char *val)
l1 = strlen(name)+1;
l2 = strlen(val)+1;
- variables = (char *)Realloc(variables, shared_size + l1+l2+4);
+ var = (char *)Realloc(variables, shared_size + l1+l2+4);
- if (!variables) {
+ if (!var) {
DEBUG(0,("out of memory in smbw_setshared\n"));
exit(1);
}
+
+ variables = var;
SSVAL(&variables[shared_size], 0, l1);
SSVAL(&variables[shared_size], 2, l2);
diff --git a/source3/smbwrapper/smbw_dir.c b/source3/smbwrapper/smbw_dir.c
index cd10b488a1..6be88e4df3 100644
--- a/source3/smbwrapper/smbw_dir.c
+++ b/source3/smbwrapper/smbw_dir.c
@@ -87,7 +87,7 @@ static void smbw_dir_add(struct file_info *finfo, const char *mask,
cdl = (struct file_info *)Realloc(cur_dir->list,
sizeof(cur_dir->list[0])*
(cur_dir->count+100));
- if (!cur_dir->list) {
+ if (!cdl) {
/* oops */
return;
}