summaryrefslogtreecommitdiffabout
path: root/src/triplet.c
Side-by-side diff
Diffstat (limited to 'src/triplet.c') (more/less context) (show whitespace changes)
-rw-r--r--src/triplet.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/triplet.c b/src/triplet.c
index 3083c64..9dfdf2c 100644
--- a/src/triplet.c
+++ b/src/triplet.c
@@ -57,12 +57,13 @@ hash_triplet_free (void *data)
txtacc_free (tp->acc);
/* Free uploader list */
for (up = tp->uploader_list; up; )
{
struct uploader_info *next = up->next;
+ free (up->fpr);
free (up);
up = next;
}
free (tp);
}
@@ -91,13 +92,13 @@ register_file (struct file_info *finfo, const struct spool *spool)
NULL,
hash_triplet_free);
if (!triplet_table)
grecs_alloc_die ();
}
- key.name = xmalloc (finfo->root_len + 1);
+ key.name = grecs_malloc (finfo->root_len + 1);
memcpy (key.name, finfo->name, finfo->root_len);
key.name[finfo->root_len] = 0;
ret = grecs_symtab_lookup_or_install (triplet_table, &key, &install);
if (!ret)
grecs_alloc_die ();
@@ -375,26 +376,26 @@ format_file_data (struct file_triplet *trp, enum file_type type, char **pret)
group_name = "unknown"; /* should not happen */
else
group_name = grp->gr_name;
/* Size */
if (grecs_asprintf (&sptr, &slen, "%lu", (unsigned long) info->sb.st_size))
- xalloc_die ();
+ grecs_alloc_die ();
/* Figure out padding and format the buffer */
slen = strlen (sptr);
pad = strlen (user_name) + 1 + strlen (group_name) + 1 + slen;
if (pad > ugswidth)
ugswidth = pad;
if (grecs_asprintf (&buf, &size,
"%s %s %s %*s %s %s",
modes, user_name, group_name, ugswidth - pad + slen,
sptr,
timebuf, info->name))
- xalloc_die ();
+ grecs_alloc_die ();
free (sptr);
*pret = buf;
return 0;
}
static const char *
@@ -408,13 +409,13 @@ expand_triplet_ls_full (struct metadef *def, void *data)
size += strlen (buf[file_dist]) + 1;
if (format_file_data (trp, file_signature, &buf[file_signature]) == 0)
size += strlen (buf[file_signature]) + 1;
if (format_file_data (trp, file_directive, &buf[file_directive]) == 0)
size += strlen (buf[file_directive]) + 1;
- def->value = def->storage = xmalloc (size + 1);
+ def->value = def->storage = grecs_malloc (size + 1);
def->value[0] = 0;
if (buf[file_dist])
{
strcat (def->value, buf[file_dist]);
strcat (def->value, "\n");
}
@@ -443,13 +444,13 @@ expand_triplet_ls_upload (struct metadef *def, void *data)
if (format_file_data (trp, file_dist, &buf[file_dist]) == 0)
size += strlen (buf[file_dist]) + 1;
if (format_file_data (trp, file_signature, &buf[file_signature]) == 0)
size += strlen (buf[file_signature]) + 1;
- def->value = def->storage = xmalloc (size + 1);
+ def->value = def->storage = grecs_malloc (size + 1);
def->value[0] = 0;
if (buf[file_dist])
{
strcat (def->value, buf[file_dist]);
strcat (def->value, "\n");
}
@@ -549,13 +550,13 @@ expand_email_user (struct metadef *def, void *data)
struct file_triplet *trp = data;
if (trp->uploader)
{
size_t size = 0;
if (grecs_asprintf (&def->storage, &size, "\"%s\" <%s>",
trp->uploader->realname, trp->uploader->email))
- xalloc_die ();
+ grecs_alloc_die ();
def->value = def->storage;
}
return def->value;
}
static const char *
@@ -591,21 +592,21 @@ expand_check_result (struct metadef *def, void *data)
else if (WIFEXITED (status))
{
size_t size = 0;
def->storage = NULL;
if (grecs_asprintf (&def->storage, &size,
"%d", WEXITSTATUS (status)))
- xalloc_die ();
+ grecs_alloc_die ();
}
else if (WIFSIGNALED (status))
{
size_t size = 0;
def->storage = NULL;
if (grecs_asprintf (&def->storage, &size, "SIG+%d",
WTERMSIG (status)))
- xalloc_die ();
+ grecs_alloc_die ();
}
else
return def->value = "[unrecognized return code]";
return def->value = def->storage;
}

Return to:

Send suggestions and report system problems to the System administrator.