X-Git-Url: https://git.tokkee.org/?p=rrdtool-all.git;a=blobdiff_plain;f=program%2Fsrc%2Frrd_xport.c;fp=program%2Fsrc%2Frrd_xport.c;h=ebe72aad40b28e6627d63851245cf4c84fa0daff;hp=b2afd1cb25fa0db3c7218e3401d249de6c8b376c;hb=948659f1493a73dd00df14791a094b6b2e757a3a;hpb=2bbfc960d7df66dc2aeddb4b5c9c76e9e95907b3 diff --git a/program/src/rrd_xport.c b/program/src/rrd_xport.c index b2afd1cb..ebe72aad 100644 --- a/program/src/rrd_xport.c +++ b/program/src/rrd_xport.c @@ -308,10 +308,9 @@ int rrd_xport_fn( *step_list_ptr = im->gdes[im->gdes[i].vidx].step; /* printf("%s:%lu\n",im->gdes[i].legend,*step_list_ptr); */ step_list_ptr++; + /* reserve room for one legend entry */ - /* is FMT_LEG_LEN + 5 the correct size? */ - if ((legend_list[j] = - (char*)malloc(sizeof(char) * (FMT_LEG_LEN + 5))) == NULL) { + if ((legend_list[j] = strdup(im->gdes[i].legend)) == NULL) { free(ref_list); *data = NULL; while (--j > -1) @@ -322,11 +321,9 @@ int rrd_xport_fn( return (-1); } - if (im->gdes[i].legend) - /* omit bounds check, should have the same size */ - strcpy(legend_list[j++], im->gdes[i].legend); - else - legend_list[j++][0] = '\0'; + if (im->gdes[i].legend == 0) + legend_list[j][0] = '\0'; + ++j; } } *step_list_ptr=0;