summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3790ee4)
raw | patch | inline | side by side (parent: 3790ee4)
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) |
src/rrd_rpncalc.c | patch | blob | history | |
src/rrd_update.c | patch | blob | history |
diff --git a/src/rrd_rpncalc.c b/src/rrd_rpncalc.c
index e392a656bb95163bf7116d5a00014445f5be01d5..dca2ae13d45675fd30f4a783b3c31f30f8dc29a2 100644 (file)
--- a/src/rrd_rpncalc.c
+++ b/src/rrd_rpncalc.c
/* 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 = rpnc[i].op;
if (rpnp[i].op == OP_NUMBER) {
diff --git a/src/rrd_update.c b/src/rrd_update.c
index 4016d75714b179e8d9626388ece697bdfa4b827a..0335a9ef27670a37e1e10675ac3281dac8f9d710 100644 (file)
--- a/src/rrd_update.c
+++ b/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 */