Index: usr.bin/tset/map.c =================================================================== --- usr.bin/tset/map.c +++ usr.bin/tset/map.c @@ -76,9 +76,13 @@ char *copy, *p, *termp; copy = strdup(arg); + if (copy == NULL) + errx(1, "malloc"); mapp = malloc(sizeof(MAP)); - if (copy == NULL || mapp == NULL) + if (mapp == NULL) { + free(copy); errx(1, "malloc"); + } mapp->next = NULL; if (maplist == NULL) cur = maplist = mapp; @@ -153,6 +157,7 @@ /* If user specified a port with an option flag, set it. */ done: if (port) { + /* XXX no way to free 'copy' */ if (mapp->porttype) badmopt: errx(1, "illegal -m option format: %s", copy); mapp->porttype = strdup(port); @@ -175,6 +180,7 @@ (void)printf("%sLT", p); (void)printf("\nspeed: %d\n", mapp->speed); #endif + free(copy); } /*