-/* $OpenBSD: args.c,v 1.29 2018/01/03 19:12:20 schwarze Exp $ */
+/* $OpenBSD: args.c,v 1.30 2018/07/25 15:09:48 cheloha Exp $ */
/* $NetBSD: args.c,v 1.7 1996/03/01 01:18:58 jtc Exp $ */
/*-
in.dbsz = out.dbsz = 512;
- while ((oper = *++argv) != NULL) {
- if ((oper = strdup(oper)) == NULL)
- errx(1, "out of memory");
+ while (*++argv != NULL) {
+ if ((oper = strdup(*argv)) == NULL)
+ err(1, NULL);
if ((arg = strchr(oper, '=')) == NULL)
errx(1, "unknown operand %s", oper);
*arg++ = '\0';
tmp.name);
ddflags |= ap->set;
ap->f(arg);
+ free(oper);
}
/* Final sanity checks. */
static void
f_if(char *arg)
{
-
- in.name = arg;
+ if ((in.name = strdup(arg)) == NULL)
+ err(1, NULL);
}
static void
static void
f_of(char *arg)
{
-
- out.name = arg;
+ if ((out.name = strdup(arg)) == NULL)
+ err(1, NULL);
}
static void