[svn] Remove emptyline craq because it leaks memory on /rehash motd etc.

from ratbox 2.2 (anfl/Androsyn)
This commit is contained in:
jilles 2007-05-02 12:56:40 -07:00
parent 1117fbd3d5
commit 1d3e262e40
3 changed files with 21 additions and 16 deletions

View File

@ -1,3 +1,16 @@
jilles 2007/04/28 23:47:25 UTC (20070428-3434)
Log:
Merge old trunk r2767:
Copy channel name from command on lowerTS JOIN/SJOIN,
this makes the capitalization of the channel name
timestamped like modes are.
Changes: Modified:
+3 -0 trunk/modules/core/m_join.c (File Modified)
+3 -0 trunk/modules/core/m_sjoin.c (File Modified)
jilles 2007/04/26 23:01:16 UTC (20070426-3432) jilles 2007/04/26 23:01:16 UTC (20070426-3432)
Log: Log:
Merge old trunk r2065,r2067: Merge old trunk r2065,r2067:

View File

@ -1 +1 @@
#define SERNO "20070426-3432" #define SERNO "20070428-3434"

View File

@ -29,7 +29,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: cache.c 254 2005-09-21 23:35:12Z nenolod $ * $Id: cache.c 3436 2007-05-02 19:56:40Z jilles $
*/ */
#include "stdinc.h" #include "stdinc.h"
@ -50,7 +50,6 @@ static BlockHeap *cacheline_heap = NULL;
struct cachefile *user_motd = NULL; struct cachefile *user_motd = NULL;
struct cachefile *oper_motd = NULL; struct cachefile *oper_motd = NULL;
struct cacheline *emptyline = NULL;
dlink_list links_cache_list; dlink_list links_cache_list;
char user_motd_changed[MAX_DATE_STRING]; char user_motd_changed[MAX_DATE_STRING];
@ -66,10 +65,6 @@ init_cache(void)
cachefile_heap = BlockHeapCreate(sizeof(struct cachefile), CACHEFILE_HEAP_SIZE); cachefile_heap = BlockHeapCreate(sizeof(struct cachefile), CACHEFILE_HEAP_SIZE);
cacheline_heap = BlockHeapCreate(sizeof(struct cacheline), CACHELINE_HEAP_SIZE); cacheline_heap = BlockHeapCreate(sizeof(struct cacheline), CACHELINE_HEAP_SIZE);
/* allocate the emptyline */
emptyline = BlockHeapAlloc(cacheline_heap);
emptyline->data[0] = ' ';
emptyline->data[1] = '\0';
user_motd_changed[0] = '\0'; user_motd_changed[0] = '\0';
user_motd = cache_file(MPATH, "ircd.motd", 0); user_motd = cache_file(MPATH, "ircd.motd", 0);
@ -124,14 +119,12 @@ cache_file(const char *filename, const char *shortname, int flags)
if((p = strchr(line, '\n')) != NULL) if((p = strchr(line, '\n')) != NULL)
*p = '\0'; *p = '\0';
if(!EmptyString(line)) lineptr = BlockHeapAlloc(cacheline_heap);
{ if(EmptyString(line))
lineptr = BlockHeapAlloc(cacheline_heap); strlcpy(lineptr->data, " ", sizeof(lineptr->data));
strlcpy(lineptr->data, line, sizeof(lineptr->data));
dlinkAddTail(lineptr, &lineptr->linenode, &cacheptr->contents);
}
else else
dlinkAddTailAlloc(emptyline, &cacheptr->contents); strlcpy(lineptr->data, line, sizeof(lineptr->data));
dlinkAddTail(lineptr, &lineptr->linenode, &cacheptr->contents);
} }
fclose(in); fclose(in);
@ -192,8 +185,7 @@ free_cachefile(struct cachefile *cacheptr)
DLINK_FOREACH_SAFE(ptr, next_ptr, cacheptr->contents.head) DLINK_FOREACH_SAFE(ptr, next_ptr, cacheptr->contents.head)
{ {
if(ptr->data != emptyline) BlockHeapFree(cacheline_heap, ptr->data);
BlockHeapFree(cacheline_heap, ptr->data);
} }
BlockHeapFree(cachefile_heap, cacheptr); BlockHeapFree(cachefile_heap, cacheptr);