mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-17 10:35:10 +00:00
Clean up a few valgrind errors, add realloc-failure handling for graphs. (#367)
I think this fixes #360
This commit is contained in:
parent
e84ca1f966
commit
a58a6d4e08
@ -521,11 +521,15 @@ void new_graph(struct text_object *obj, char *buf, int buf_max_size, double val)
|
|||||||
/* initialize */
|
/* initialize */
|
||||||
std::fill_n(graph, s->graph_width, 0.0);
|
std::fill_n(graph, s->graph_width, 0.0);
|
||||||
s->scale = 100;
|
s->scale = 100;
|
||||||
} else {
|
} else if (graph) {
|
||||||
if (s->graph_width > s->graph_allocated) {
|
if (s->graph_width > s->graph_allocated) {
|
||||||
/* initialize the new region */
|
/* initialize the new region */
|
||||||
std::fill(graph + s->graph_allocated, graph + s->graph_width, 0.0);
|
std::fill(graph + s->graph_allocated, graph + s->graph_width, 0.0);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
DBGP("reallocing FAILED");
|
||||||
|
graph = s->graph;
|
||||||
|
s->graph_width = s->graph_allocated;
|
||||||
}
|
}
|
||||||
s->graph = graph;
|
s->graph = graph;
|
||||||
s->graph_allocated = s->graph_width;
|
s->graph_allocated = s->graph_width;
|
||||||
|
@ -99,8 +99,8 @@ static char *backslash_escape(const char *src, char **templates, unsigned int te
|
|||||||
}
|
}
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
src_dup[dup_idx] = '\0';
|
src_dup[dup_idx++] = '\0';
|
||||||
src_dup = (char*) realloc(src_dup, (strlen(src_dup) + 1) * sizeof(char));
|
src_dup = (char*) realloc(src_dup, dup_idx * sizeof(char));
|
||||||
return src_dup;
|
return src_dup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,6 +492,7 @@ static void update_workarea(void)
|
|||||||
workarea[1] = ps->y_org;
|
workarea[1] = ps->y_org;
|
||||||
workarea[2] = workarea[0] + ps->width;
|
workarea[2] = workarea[0] + ps->width;
|
||||||
workarea[3] = workarea[1] + ps->height;
|
workarea[3] = workarea[1] + ps->height;
|
||||||
|
XFree(si);
|
||||||
|
|
||||||
DBGP("Fixed xinerama area to: %d %d %d %d",
|
DBGP("Fixed xinerama area to: %d %d %d %d",
|
||||||
workarea[0], workarea[1], workarea[2], workarea[3]);
|
workarea[0], workarea[1], workarea[2], workarea[3]);
|
||||||
|
Loading…
Reference in New Issue
Block a user