summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d8b7b20)
raw | patch | inline | side by side (parent: d8b7b20)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 22 Aug 2010 17:56:02 +0000 (17:56 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 22 Aug 2010 17:56:02 +0000 (17:56 +0000) |
field 'filename' is uninitialized. So, if a sql error happens, it does not print an error like this
rrd_set_error( "libdbi: problems connecting to db with connect string %s - error: %s",th->filename,dbi_errstr);
instead of, it dumps core.
Second bug: when the output data buffer is allocated, it allocated for 'rows-1' max index, but in
'fetch loop' 'idx' may be equal to 'rows', so it needs one more extra record in data.
-- Pavel Nikiforov pavel artx.ru
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@2118 a5681a0c-68f1-0310-ab6d-d61299d08faa
rrd_set_error( "libdbi: problems connecting to db with connect string %s - error: %s",th->filename,dbi_errstr);
instead of, it dumps core.
Second bug: when the output data buffer is allocated, it allocated for 'rows-1' max index, but in
'fetch loop' 'idx' may be equal to 'rows', so it needs one more extra record in data.
-- Pavel Nikiforov pavel artx.ru
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@2118 a5681a0c-68f1-0310-ab6d-d61299d08faa
program/src/rrd_fetch_libdbi.c | patch | blob | history |
index 7ca809e34f613193ddc04ae97abaaccdaaf84c42..fb0dc7e81aef9b3794e28fea962ec19fe8a040a3 100644 (file)
char where[10240];
table_help.conn=NULL;
table_help.where=where;
+ table_help.filtename=filename;
/* some loop variables */
int i=0;
}
/* allocate memory for resultset (with the following columns: min,avg,max,count,sigma) */
- i=rows * sizeof(rrd_value_t)*(*ds_cnt);
+ i=(rows+1) * sizeof(rrd_value_t)*(*ds_cnt);
if (((*data) = malloc(i))==NULL){
/* and return error */
rrd_set_error("malloc failed for %i bytes",i);