1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

fixed a bunch of errors found by cppcheck

This commit is contained in:
Steffen Vogel 2020-09-10 18:23:25 +02:00
parent e176e93d05
commit e895d1479c
4 changed files with 10 additions and 19 deletions

View file

@ -75,10 +75,10 @@ public:
~JitterCalcHook()
{
delete jitter_val;
delete delay_series;
delete moving_avg;
delete moving_var;
delete[] jitter_val;
delete[] delay_series;
delete[] moving_avg;
delete[] moving_var;
}
/**

View file

@ -662,7 +662,6 @@ char * ngsi_print(struct vnode *n)
int ngsi_start(struct vnode *n)
{
struct ngsi *i = (struct ngsi *) n->_vd;
int ret;
i->in.curl = curl_easy_init();
i->out.curl = curl_easy_init();
@ -696,14 +695,14 @@ int ngsi_start(struct vnode *n)
if (i->create) {
json_t *json_entity = ngsi_build_entity(n, nullptr, 0, NGSI_ENTITY_ATTRIBUTES | NGSI_ENTITY_METADATA);
ret = ngsi_request_context_update(i->out.curl, i->endpoint, "APPEND", json_entity);
int ret = ngsi_request_context_update(i->out.curl, i->endpoint, "APPEND", json_entity);
if (ret)
throw RuntimeError("Failed to create NGSI context for node {}", node_name(n));
json_decref(json_entity);
}
return ret;
return 0;
}
int ngsi_stop(struct vnode *n)

View file

@ -66,13 +66,11 @@ struct sample * sample_alloc_mem(int capacity)
{
size_t sz = SAMPLE_LENGTH(capacity);
char *b = new char[sz];
if (!b)
auto *s = (struct sample *) new char[sz];
if (!s)
throw MemoryAllocationError();
memset(b, 0, sz);
struct sample *s = (struct sample *) b;
memset((void *) s, 0, sz);
s->pool_off = SAMPLE_NON_POOL;

View file

@ -191,15 +191,11 @@ check: if (optarg == endptr)
int ret, recv, sent;
struct format_type *ft;
struct sample **smps;
struct sample *smps[cnt];
if (cnt < 1)
throw RuntimeError("Vectorize option must be greater than 0");
smps = new struct sample*[cnt];
if (!smps)
throw MemoryAllocationError();
ret = pool_init(&p, 10 * cnt, SAMPLE_LENGTH(DEFAULT_SAMPLE_LENGTH));
if (ret)
throw RuntimeError("Failed to initilize memory pool");
@ -301,8 +297,6 @@ stop: sent = io_print(&io, smps, send);
sample_free_many(smps, cnt);
delete smps;
ret = pool_destroy(&p);
if (ret)
throw RuntimeError("Failed to destroy memory pool");