56 |
|
static struct Motd * |
57 |
|
motd_create(const char *hostmask, const char *path) |
58 |
|
{ |
59 |
< |
struct Motd *tmp = MyMalloc(sizeof(struct Motd)); |
59 |
> |
struct Motd *tmp = MyCalloc(sizeof(struct Motd)); |
60 |
|
|
61 |
|
if (EmptyString(hostmask)) |
62 |
|
tmp->type = MOTD_UNIVERSAL; |
142 |
|
} |
143 |
|
|
144 |
|
/* Ok, allocate a structure; we'll realloc later to trim memory */ |
145 |
< |
cache = MyMalloc(sizeof(struct MotdCache) + (MOTD_LINESIZE * MOTD_MAXLINES)); |
145 |
> |
cache = MyCalloc(sizeof(struct MotdCache) + (MOTD_LINESIZE * MOTD_MAXLINES)); |
146 |
|
cache->ref = 1; |
147 |
|
cache->path = xstrdup(motd->path); |
148 |
|
cache->maxcount = motd->maxcount; |
161 |
|
fclose(file); /* Close the file */ |
162 |
|
|
163 |
|
/* Trim memory usage a little */ |
164 |
< |
motd->cache = MyMalloc(sizeof(struct MotdCache) + |
164 |
> |
motd->cache = MyCalloc(sizeof(struct MotdCache) + |
165 |
|
(MOTD_LINESIZE * cache->count)); |
166 |
|
memcpy(motd->cache, cache, sizeof(struct MotdCache) + |
167 |
|
(MOTD_LINESIZE * cache->count)); |