summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1477e5e)
raw | patch | inline | side by side (parent: 1477e5e)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sat, 16 Dec 2006 16:13:53 +0000 (16:13 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sat, 16 Dec 2006 16:13:53 +0000 (16:13 +0000) |
add \0 to the end of several strncpy strings
add missing free
fix error string rendering :... makes no sense here
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@937 a5681a0c-68f1-0310-ab6d-d61299d08faa
add missing free
fix error string rendering :... makes no sense here
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@937 a5681a0c-68f1-0310-ab6d-d61299d08faa
src/rrd_update.c | patch | blob | history |
diff --git a/src/rrd_update.c b/src/rrd_update.c
index 9d7d251e3eccdd65e442d1d1de67f11b3d30244e..0f32121e35094bab9b02a760f7eead04e2c8e5ec 100644 (file)
--- a/src/rrd_update.c
+++ b/src/rrd_update.c
unsigned long rrd_filesize;
#endif
+
rpnstack_init(&rpnstack);
/* need at least 1 arguments: data. */
#endif
/* loop through the arguments. */
for(arg_i=0; arg_i<argc;arg_i++) {
- char *stepper = malloc((strlen(argv[arg_i])+1)*sizeof(char));
+ char *stepper = strdup(argv[arg_i]);
char *step_start = stepper;
char *p;
char *parsetime_error = NULL;
struct rrd_time_value ds_tv;
if (stepper == NULL){
rrd_set_error("failed duplication argv entry");
+ free(step_start);
free(updvals);
free(pdp_temp);
free(tmpl_idx);
/* initialize all ds input to unknown except the first one
which has always got to be set */
for(ii=1;ii<=rrd.stat_head->ds_cnt;ii++) updvals[ii] = "U";
- strcpy(stepper,argv[arg_i]);
updvals[0]=stepper;
/* separate all ds elements; first must be examined separately
due to alternate time syntax */
*p = '\0';
stepper = p+1;
} else {
- rrd_set_error("expected timestamp not found in data source from %s:...",
+ rrd_set_error("expected timestamp not found in data source from %s",
argv[arg_i]);
free(step_start);
break;
}
if (ii != tmpl_cnt-1) {
- rrd_set_error("expected %lu data source readings (got %lu) from %s:...",
+ rrd_set_error("expected %lu data source readings (got %lu) from %s",
tmpl_cnt-1, ii, argv[arg_i]);
free(step_start);
break;
if(rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt < interval
&& ( dst_idx == DST_COUNTER || dst_idx == DST_DERIVE)){
strncpy(rrd.pdp_prep[i].last_ds,"U",LAST_DS_LEN-1);
+ rrd.pdp_prep[i].last_ds[LAST_DS_LEN-1]='\0';
}
/* NOTE: DST_CDEF should never enter this if block, because