Merge lp:~brianaker/gearmand/fix-ssl-valgrind into lp:gearmand

Proposed by Brian Aker on 2013-06-26
Status: Merged
Merged at revision: 784
Proposed branch: lp:~brianaker/gearmand/fix-ssl-valgrind
Merge into: lp:gearmand
Diff against target: 152 lines (+19/-17)
5 files modified
libgearman-server/connection.cc (+14/-11)
libgearman-server/connection.h (+1/-1)
libgearman-server/gearmand_con.cc (+1/-1)
libgearman-server/io.cc (+0/-1)
libgearman-server/struct/io.h (+3/-3)
To merge this branch: bzr merge lp:~brianaker/gearmand/fix-ssl-valgrind
Reviewer Review Type Date Requested Status
Tangent Trunk 2013-06-26 Pending
Review via email: mp+171694@code.launchpad.net

Description of the change

Fix for valgrind warning with ssl.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libgearman-server/connection.cc'
2--- libgearman-server/connection.cc 2013-06-15 09:43:55 +0000
3+++ libgearman-server/connection.cc 2013-06-26 23:53:27 +0000
4@@ -50,27 +50,27 @@
5 #include <assert.h>
6
7 static gearman_server_con_st * _server_con_create(gearman_server_thread_st *thread, gearmand_con_st *dcon,
8- gearmand_error_t *ret);
9+ gearmand_error_t& ret);
10
11 /*
12 * Public definitions
13 */
14
15-gearman_server_con_st *gearman_server_con_add(gearman_server_thread_st *thread, gearmand_con_st *dcon, gearmand_error_t *ret)
16+gearman_server_con_st *gearman_server_con_add(gearman_server_thread_st *thread, gearmand_con_st *dcon, gearmand_error_t& ret)
17 {
18 gearman_server_con_st *con= _server_con_create(thread, dcon, ret);
19 if (con)
20 {
21- if ((*ret= gearman_io_set_fd(&(con->con), dcon->fd)) != GEARMAND_SUCCESS)
22+ if ((ret= gearman_io_set_fd(&(con->con), dcon->fd)) != GEARMAND_SUCCESS)
23 {
24 gearman_server_con_free(con);
25 return NULL;
26 }
27
28- *ret= gearmand_io_set_events(con, POLLIN);
29- if (*ret != GEARMAND_SUCCESS)
30+ ret= gearmand_io_set_events(con, POLLIN);
31+ if (ret != GEARMAND_SUCCESS)
32 {
33- gearmand_gerror("gearmand_io_set_events", *ret);
34+ gearmand_gerror("gearmand_io_set_events", ret);
35 gearman_server_con_free(con);
36 return NULL;
37 }
38@@ -81,7 +81,7 @@
39
40 static gearman_server_con_st * _server_con_create(gearman_server_thread_st *thread,
41 gearmand_con_st *dcon,
42- gearmand_error_t *ret)
43+ gearmand_error_t& ret)
44 {
45 gearman_server_con_st *con;
46
47@@ -95,7 +95,7 @@
48 con= new (std::nothrow) gearman_server_con_st;
49 if (con == NULL)
50 {
51- *ret= gearmand_perror(errno, "new() build_gearman_server_con_st");
52+ ret= gearmand_perror(errno, "new() build_gearman_server_con_st");
53 return NULL;
54 }
55 }
56@@ -104,7 +104,7 @@
57 if (con == NULL)
58 {
59 gearmand_error("Neigther an allocated gearman_server_con_st() or free listed could be found");
60- *ret= GEARMAND_MEMORY_ALLOCATION_FAILURE;
61+ ret= GEARMAND_MEMORY_ALLOCATION_FAILURE;
62 return NULL;
63 }
64
65@@ -148,6 +148,9 @@
66 con->timeout_event= NULL;
67
68 con->protocol= NULL;
69+#if defined(HAVE_CYASSL) && HAVE_CYASSL
70+ con->_ssl= NULL;
71+#endif
72
73 int error;
74 if ((error= pthread_mutex_lock(&thread->lock)) == 0)
75@@ -158,7 +161,7 @@
76 gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_lock");
77 gearman_server_con_free(con);
78
79- *ret= GEARMAND_ERRNO;
80+ ret= GEARMAND_ERRNO;
81 return NULL;
82 }
83 }
84@@ -168,7 +171,7 @@
85 gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_lock");
86 gearman_server_con_free(con);
87
88- *ret= GEARMAND_ERRNO;
89+ ret= GEARMAND_ERRNO;
90 return NULL;
91 }
92
93
94=== modified file 'libgearman-server/connection.h'
95--- libgearman-server/connection.h 2013-03-06 04:50:21 +0000
96+++ libgearman-server/connection.h 2013-06-26 23:53:27 +0000
97@@ -75,7 +75,7 @@
98 */
99 GEARMAN_API
100 gearman_server_con_st *gearman_server_con_add(gearman_server_thread_st *thread, gearmand_con_st *dcon,
101- gearmand_error_t *ret);
102+ gearmand_error_t& ret);
103
104 /**
105 * Attempt to free a server connection structure.
106
107=== modified file 'libgearman-server/gearmand_con.cc'
108--- libgearman-server/gearmand_con.cc 2013-05-05 03:23:55 +0000
109+++ libgearman-server/gearmand_con.cc 2013-06-26 23:53:27 +0000
110@@ -63,7 +63,7 @@
111 gearmand_con_st *dcon)
112 {
113 gearmand_error_t ret= GEARMAND_SUCCESS;
114- dcon->server_con= gearman_server_con_add(&(thread->server_thread), dcon, &ret);
115+ dcon->server_con= gearman_server_con_add(&(thread->server_thread), dcon, ret);
116
117 assert(dcon->server_con || ret != GEARMAND_SUCCESS);
118 assert(! dcon->server_con || ret == GEARMAND_SUCCESS);
119
120=== modified file 'libgearman-server/io.cc'
121--- libgearman-server/io.cc 2013-06-05 21:59:31 +0000
122+++ libgearman-server/io.cc 2013-06-26 23:53:27 +0000
123@@ -362,7 +362,6 @@
124 }
125 }
126
127-
128 connection->_state= gearmand_io_st::GEARMAND_CON_UNIVERSAL_INVALID;
129 connection->send_state= gearmand_io_st::GEARMAND_CON_SEND_STATE_NONE;
130 connection->recv_state= gearmand_io_st::GEARMAND_CON_RECV_UNIVERSAL_NONE;
131
132=== modified file 'libgearman-server/struct/io.h'
133--- libgearman-server/struct/io.h 2013-05-11 10:16:19 +0000
134+++ libgearman-server/struct/io.h 2013-06-26 23:53:27 +0000
135@@ -139,6 +139,9 @@
136 char id[GEARMAND_SERVER_CON_ID_SIZE];
137 gearmand::protocol::Context* protocol;
138 struct event *timeout_event;
139+#if defined(HAVE_CYASSL) && HAVE_CYASSL
140+ CYASSL* _ssl;
141+#endif
142
143 gearman_server_con_st()
144 {
145@@ -166,7 +169,4 @@
146 protocol= NULL;
147 }
148 }
149-#if defined(HAVE_CYASSL) && HAVE_CYASSL
150- CYASSL* _ssl;
151-#endif
152 };

Subscribers

People subscribed via source and target branches

to all changes: