From: pjk Date: Fri, 23 Apr 2004 18:41:02 +0000 (+0000) Subject: Fix bug where a copy dest spec would cause a failed assertion in strdup X-Git-Tag: v0.4.0~273 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;h=edc8eacf99f63067b0b2afe8feede2357a270614;p=pspp-builds.git Fix bug where a copy dest spec would cause a failed assertion in strdup Fix bug where a copy dest spec would cause the wrong member of the union to be copied --- diff --git a/src/recode.c b/src/recode.c index e415dcf8..90a405c8 100644 --- a/src/recode.c +++ b/src/recode.c @@ -232,7 +232,7 @@ cmd_recode (void) else { for (i = mark; i < rcd->nmap; i++) - rcd->map[i].t.c = xstrdup (output.c); + rcd->map[i].t.c = (output.c?xstrdup (output.c):NULL); free (output.c); } } @@ -805,9 +805,9 @@ recode_trns_proc (struct trns_header * t, struct ccase * c, else { char *val = cp->t.c; - if (val == NULL) + if (val == NULL) st_bare_pad_len_copy (c->data[v->dest->fv].s, - c->data[v->src->fv].c, + c->data[v->src->fv].s, v->dest->width, v->src->width); else memcpy (c->data[v->dest->fv].s, cp->t.c, v->dest->width);