Hello community,
here is the log from the commit of package conky for openSUSE:Factory checked in at 2019-07-02 10:39:29
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/conky (Old)
and /work/SRC/openSUSE:Factory/.conky.new.4615 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "conky"
Tue Jul 2 10:39:29 2019 rev:25 rq:712925 version:1.11.4
Changes:
--------
--- /work/SRC/openSUSE:Factory/conky/conky.changes 2019-06-24 21:54:03.712138397 +0200
+++ /work/SRC/openSUSE:Factory/.conky.new.4615/conky.changes 2019-07-02 10:39:31.850685444 +0200
@@ -1,0 +2,5 @@
+Fri Jun 28 09:31:44 UTC 2019 - Dead Mozay
+
+- Add conky-memory-leak-fix.patch Fixes a memory leak in Conky
+
+-------------------------------------------------------------------
New:
----
conky-memory-leak-fix.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ conky.spec ++++++
--- /var/tmp/diff_new_pack.dGcWy2/_old 2019-07-02 10:39:32.470686388 +0200
+++ /var/tmp/diff_new_pack.dGcWy2/_new 2019-07-02 10:39:32.470686388 +0200
@@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@@ -37,6 +37,7 @@
Source3: README.SUSE
Patch1: conky-1.10.1-avoid-git.patch
Patch2: conky.timestamp.patch
+Patch3: conky-memory-leak-fix.patch
BuildRequires: cmake
BuildRequires: docbook-xsl-stylesheets
BuildRequires: docbook2x
@@ -50,6 +51,7 @@
BuildRequires: libxslt-tools
BuildRequires: lua53-devel
BuildRequires: ncurses-devel
+BuildRequires: ninja
BuildRequires: pkgconfig
BuildRequires: update-desktop-files
BuildRequires: pkgconfig(glib-2.0)
@@ -138,7 +140,7 @@
%autopatch -p1
%build
-%cmake \
+%cmake -G Ninja \
-DBUILD_APCUPSD=ON \
-DBUILD_ARGB=ON \
%if %{with audacious}
@@ -205,7 +207,7 @@
-DOWN_WINDOW=ON \
-DBUILD_XMMS2=OFF
-%cmake_build
+%ninja_build
# build doc
cd ../doc
@@ -224,7 +226,7 @@
gzip conky.1
%install
-%cmake_install
+%ninja_install -C build
# not doc
rm -rf %{buildroot}%{_datadir}/doc/%{name}-%{version}
++++++ conky-memory-leak-fix.patch ++++++
diff --git a/src/specials.cc b/src/specials.cc
index 70ac491b..3ddcf505 100644
--- a/src/specials.cc
+++ b/src/specials.cc
@@ -508,7 +508,7 @@ graph_buf_end:
}
double *copy_graph(double *original_graph, int graph_width) {
- double *new_graph = new double[graph_width];
+ double *new_graph = static_cast(malloc(graph_width * sizeof(double)));
memcpy(new_graph, original_graph, graph_width * sizeof(double));
@@ -517,7 +517,7 @@ double *copy_graph(double *original_graph, int graph_width) {
double *retrieve_graph(int graph_id, int graph_width) {
if (graphs.find(graph_id) == graphs.end()) {
- return new double[graph_width];
+ return static_cast(calloc(1, graph_width * sizeof(double)));
} else {
return copy_graph(graphs[graph_id], graph_width);
}
@@ -527,7 +527,10 @@ void store_graph(int graph_id, struct special_t *s) {
if (s->graph == nullptr) {
graphs[graph_id] = nullptr;
} else {
- graphs[graph_id] = copy_graph(s->graph, s->graph_width);
+ if (graphs.find(graph_id)!=graphs.end()) {
+ free(graphs[graph_id]);
+ }
+ graphs[graph_id] = s->graph;
}
}
@@ -572,6 +575,7 @@ void new_graph(struct text_object *obj, char *buf, int buf_max_size,
}
s->graph = graph;
s->graph_allocated = s->graph_width;
+ graphs[g->id] = graph;
}
s->height = g->height;
s->first_colour = adjust_colours(g->first_colour);