Merge lp:~sergei.glushchenko/percona-qa/pquery-memfix into lp:percona-qa

Proposed by Sergei Glushchenko
Status: Merged
Merged at revision: 1266
Proposed branch: lp:~sergei.glushchenko/percona-qa/pquery-memfix
Merge into: lp:percona-qa
Diff against target: 43 lines (+2/-4)
1 file modified
pquery/pquery.cpp (+2/-4)
To merge this branch: bzr merge lp:~sergei.glushchenko/percona-qa/pquery-memfix
Reviewer Review Type Date Requested Status
Roel Van de Paar (community) Approve
Review via email: mp+254705@code.launchpad.net

Description of the change

mysql_library_end should be invoked once to free all memory allocated by libmysqlclient globally.
The problem was that pquery invoked it every now and then not only globally but also in every thread.

To post a comment you must log in.
Revision history for this message
Roel Van de Paar (roel11) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'pquery/pquery.cpp'
2--- pquery/pquery.cpp 2014-11-20 00:05:35 +0000
3+++ pquery/pquery.cpp 2015-03-31 08:03:00 +0000
4@@ -68,7 +68,6 @@
5 conn = mysql_init(NULL);
6 if (conn == NULL){
7 printf("Error %u: %s\n", mysql_errno(conn), mysql_error(conn));
8- mysql_library_end();
9
10 if (thread_log != NULL){
11 fclose(thread_log);
12@@ -80,7 +79,6 @@
13 m_conndata.password, m_conndata.database, m_conndata.port, m_conndata.socket, 0) == NULL){
14 printf("Error %u: %s\n", mysql_errno(conn), mysql_error(conn));
15 mysql_close(conn);
16- mysql_library_end();
17 if (thread_log != NULL){
18 fclose(thread_log);
19 }
20@@ -134,7 +132,6 @@
21 }
22 mysql_close(conn);
23 mysql_thread_end();
24- mysql_library_end();
25 }
26
27 int main(int argc, char* argv[]){
28@@ -248,7 +245,6 @@
29 printf("MySQL Server Info: %s \n", mysql_get_server_info(conn));
30
31 mysql_close(conn);
32- mysql_library_end();
33
34 ifstream infile;
35 infile.open(m_conndata.infile);
36@@ -286,5 +282,7 @@
37 threads[i].join();
38 }
39
40+ mysql_library_end();
41+
42 return EXIT_SUCCESS;
43 }

Subscribers

People subscribed via source and target branches