summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-03-22 13:06:52 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-03-22 13:06:52 +0000
commita38e5e6850220fc1a0afa5097359c05458e1ae41 (patch)
treeb75cac324259de694c3bc3f7ca18ab664a4fa856 /source3/lib
parentb508fdfc231b73d671b0c283e54532b9f14d7db6 (diff)
downloadsamba-a38e5e6850220fc1a0afa5097359c05458e1ae41.tar.gz
samba-a38e5e6850220fc1a0afa5097359c05458e1ae41.tar.bz2
samba-a38e5e6850220fc1a0afa5097359c05458e1ae41.zip
Small clenaup patches:
- safe_string.h - don't assume that __FUNCTION__ is available - process.c - use new workaround from safe_string.h for the same - util.c - Show how many bytes we smb_panic()ed trying to smb_xmalloc() - gencache.c - Keep valgrind quiet by always null terminating. - clistr.c - Add copyright - srvstr.h - move srvstr_push into a .c file again, as a real function. - srvstr.c - revive, with 'safe' checked srvstr_push - loadparm.c - set a default for the display charset. Andrew Bartlett (This used to be commit a7eba37aadeb0b04cb1bd89deddb58be8aba825c)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/gencache.c12
-rw-r--r--source3/lib/util.c4
2 files changed, 9 insertions, 7 deletions
diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c
index 5c8ad1339b..eb0e0cd808 100644
--- a/source3/lib/gencache.c
+++ b/source3/lib/gencache.c
@@ -115,9 +115,9 @@ BOOL gencache_set(const char *keystr, const char *value, time_t timeout)
asprintf(&valstr, CACHE_DATA_FMT, (int)timeout, value);
keybuf.dptr = strdup(keystr);
- keybuf.dsize = strlen(keystr);
+ keybuf.dsize = strlen(keystr)+1;
databuf.dptr = strdup(valstr);
- databuf.dsize = strlen(valstr);
+ databuf.dsize = strlen(valstr)+1;
DEBUG(10, ("Adding cache entry with key = %s; value = %s and timeout \
= %s (%d seconds %s)\n", keybuf.dptr, value, ctime(&timeout),
(int)(timeout - time(NULL)), timeout > time(NULL) ? "ahead" : "in the past"));
@@ -167,9 +167,9 @@ BOOL gencache_set_only(const char *keystr, const char *valstr, time_t timeout)
asprintf(&datastr, CACHE_DATA_FMT, (int)timeout, valstr);
keybuf.dptr = strdup(keystr);
- keybuf.dsize = strlen(keystr);
+ keybuf.dsize = strlen(keystr)+1;
databuf.dptr = strdup(datastr);
- databuf.dsize = strlen(datastr);
+ databuf.dsize = strlen(datastr)+1;
DEBUGADD(10, ("New value = %s, new timeout = %s (%d seconds %s)", valstr,
ctime(&timeout), (int)(timeout - time(NULL)),
timeout > time(NULL) ? "ahead" : "in the past"));
@@ -206,7 +206,7 @@ BOOL gencache_del(const char *keystr)
if (!gencache_init()) return False;
keybuf.dptr = strdup(keystr);
- keybuf.dsize = strlen(keystr);
+ keybuf.dsize = strlen(keystr)+1;
DEBUG(10, ("Deleting cache entry (key = %s)\n", keystr));
ret = tdb_delete(cache, keybuf);
@@ -239,7 +239,7 @@ BOOL gencache_get(const char *keystr, char **valstr, time_t *timeout)
return False;
keybuf.dptr = strdup(keystr);
- keybuf.dsize = strlen(keystr);
+ keybuf.dsize = strlen(keystr)+1;
databuf = tdb_fetch(cache, keybuf);
if (databuf.dptr && databuf.dsize > TIMEOUT_LEN) {
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 4216310335..4f564b332a 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -2089,8 +2089,10 @@ void *smb_xmalloc(size_t size)
void *p;
if (size == 0)
smb_panic("smb_xmalloc: called with zero size.\n");
- if ((p = malloc(size)) == NULL)
+ if ((p = malloc(size)) == NULL) {
+ DEBUG(0, ("smb_xmalloc() failed to allocate %lu bytes\n", (unsigned long)size));
smb_panic("smb_xmalloc: malloc fail.\n");
+ }
return p;
}