summaryrefslogtreecommitdiffstats
path: root/bin/ps/keyword.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/ps/keyword.c')
-rw-r--r--bin/ps/keyword.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c
index 0e4241a..7c84691 100644
--- a/bin/ps/keyword.c
+++ b/bin/ps/keyword.c
@@ -246,7 +246,10 @@ parsefmt(const char *p)
continue;
if ((vent = malloc(sizeof(struct varent))) == NULL)
err(1, NULL);
- vent->var = v;
+ vent->var = malloc(sizeof(*vent->var));
+ if (vent->var == NULL)
+ err(1, NULL);
+ memcpy(vent->var, v, sizeof(*vent->var));
vent->next = NULL;
if (vhead == NULL)
vhead = vtail = vent;
OpenPOWER on IntegriCloud