summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 906aad3)
raw | patch | inline | side by side (parent: 906aad3)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 29 Apr 2010 05:40:59 +0000 (05:40 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 29 Apr 2010 05:40:59 +0000 (05:40 +0000) |
program/src/rrd_rpncalc.c | patch | blob | history | |
program/src/rrd_update.c | patch | blob | history |
index 7519a025278bccf9e204268d6babbdbd77c3c38b..d46de8067017ae22152175174166511775899a2b 100644 (file)
/* DS_CDEF_MAX_RPN_NODES is small, so at the expense of some wasted
* memory we avoid any reallocs */
rpnp = (rpnp_t *) calloc(DS_CDEF_MAX_RPN_NODES, sizeof(rpnp_t));
- if (rpnp == NULL)
+ if (rpnp == NULL) {
+ rrd_set_error("failed allocating rpnp array");
return NULL;
+ }
for (i = 0; rpnc[i].op != OP_END; ++i) {
rpnp[i].op = (enum op_en) rpnc[i].op;
if (rpnp[i].op == OP_NUMBER) {
index 37da5eda37a0d3827cff401b8830126b008a9b5d..200f412071b42e75688b40b13139df15d5213d75 100644 (file)
--- a/program/src/rrd_update.c
+++ b/program/src/rrd_update.c
rpnp =
rpn_expand((rpn_cdefds_t *) &(rrd->ds_def[ds_idx].par[DS_cdef]));
+ if(rpnp == NULL) {
+ rpnstack_free(&rpnstack);
+ return -1;
+ }
/* substitute data values for OP_VARIABLE nodes */
for (i = 0; rpnp[i].op != OP_END; i++) {
if (rpnp[i].op == OP_VARIABLE) {
rpnstack_free(&rpnstack);
return -1;
}
+ free(rpnp);
}
/* make pdp_prep ready for the next run */