diff --git a/include/ProxySQL_HTTP_Server.hpp b/include/ProxySQL_HTTP_Server.hpp
index 342af02007..7d8a28df58 100644
--- a/include/ProxySQL_HTTP_Server.hpp
+++ b/include/ProxySQL_HTTP_Server.hpp
@@ -11,9 +11,9 @@ class ProxySQL_HTTP_Server {
time_t cur_time;
pthread_mutex_t check_version_mutex;
time_t last_check_version;
- std::string * generate_header(char *);
- std::string * generate_canvas(char *);
- std::string * generate_chart(char *chart_name, char *ts, int nsets, char **dname, char **llabel, char **values);
+ std::string generate_header(char *);
+ std::string generate_canvas(char *);
+ std::string generate_chart(char *chart_name, char *ts, int nsets, char **dname, char **llabel, char **values);
char *extract_values(SQLite3_result *result, int idx, bool relative, double mult=1);
char *extract_ts(SQLite3_result *result, bool relative);
public:
diff --git a/lib/ProxySQL_HTTP_Server.cpp b/lib/ProxySQL_HTTP_Server.cpp
index e82b18a249..ff38885582 100644
--- a/lib/ProxySQL_HTTP_Server.cpp
+++ b/lib/ProxySQL_HTTP_Server.cpp
@@ -505,23 +505,23 @@ int ProxySQL_HTTP_Server::handler(void *cls, struct MHD_Connection *connection,
}
*/
if (strcmp(valmetric,"system")==0) {
- string *s = generate_header((char *)"ProxySQL Graphs");
+ string s = generate_header((char *)"ProxySQL Graphs");
char *buttons = generate_buttons((char *)"system");
- s->append(buttons);
+ s.append(buttons);
free(buttons);
- s->append("
\n");
- string *s1 = generate_canvas((char *)"myChart1");
- s->append(s1->c_str());
- s->append("
\n");
+ s.append("
\n");
+ string s1 = generate_canvas((char *)"myChart1");
+ s.append(s1.c_str());
+ s.append("
\n");
s1 = generate_canvas((char *)"myChart2");
- s->append(s1->c_str());
- s->append("
\n");
+ s.append(s1.c_str());
+ s.append("
\n");
s1 = generate_canvas((char *)"myChart3");
- s->append(s1->c_str());
- s->append("
\n");
+ s.append(s1.c_str());
+ s.append("
\n");
s1 = generate_canvas((char *)"myChart4");
- s->append(s1->c_str());
- s->append("
\n");
+ s.append(s1.c_str());
+ s.append("
\n");
SQLite3_result *cpu_sqlite = GloProxyStats->get_system_cpu_metrics(interval_i);
#ifndef NOJEM
SQLite3_result *memory_sqlite = GloProxyStats->get_system_memory_metrics(interval_i);
@@ -542,14 +542,13 @@ int ProxySQL_HTTP_Server::handler(void *cls, struct MHD_Connection *connection,
nv[1] = extract_values(cpu_sqlite,3,true,(double)1/sysconf(_SC_CLK_TCK));
ts = extract_ts(cpu_sqlite,true);
s1 = generate_chart((char *)"myChart1",ts,2,nm,nl,nv);
- s->append(s1->c_str());
+ s.append(s1.c_str());
free(nm);
free(nl);
free(nv[0]);
free(nv[1]);
free(nv);
free(ts);
-
#ifndef NOJEM
nm = (char **)malloc(sizeof(char *)*5);
@@ -572,7 +571,7 @@ int ProxySQL_HTTP_Server::handler(void *cls, struct MHD_Connection *connection,
nv[4] = extract_values(memory_sqlite,6,false);
ts = extract_ts(cpu_sqlite,true);
s1 = generate_chart((char *)"myChart2",ts,5,nm,nl,nv);
- s->append(s1->c_str());
+ s.append(s1.c_str());
free(nm);
free(nl);
free(nv[0]);
@@ -582,33 +581,35 @@ int ProxySQL_HTTP_Server::handler(void *cls, struct MHD_Connection *connection,
free(nv[4]);
free(nv);
free(ts);
+ delete memory_sqlite;
#endif
+ delete cpu_sqlite;
- s->append("