ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/motd.c
(Generate patch)

Comparing ircd-hybrid/trunk/src/motd.c (file contents):
Revision 3319 by michael, Tue Apr 15 15:41:50 2014 UTC vs.
Revision 3504 by michael, Sat May 10 19:51:29 2014 UTC

# Line 56 | Line 56 | static struct
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;
# Line 142 | Line 142 | motd_cache(struct Motd *motd)
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;
# Line 161 | Line 161 | motd_cache(struct Motd *motd)
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));

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)