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

Proposed by Brian Aker
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 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
=== modified file 'libgearman-server/connection.cc'
--- libgearman-server/connection.cc 2013-06-15 09:43:55 +0000
+++ libgearman-server/connection.cc 2013-06-26 23:53:27 +0000
@@ -50,27 +50,27 @@
50#include <assert.h>50#include <assert.h>
5151
52static gearman_server_con_st * _server_con_create(gearman_server_thread_st *thread, gearmand_con_st *dcon,52static gearman_server_con_st * _server_con_create(gearman_server_thread_st *thread, gearmand_con_st *dcon,
53 gearmand_error_t *ret);53 gearmand_error_t& ret);
5454
55/*55/*
56 * Public definitions56 * Public definitions
57 */57 */
5858
59gearman_server_con_st *gearman_server_con_add(gearman_server_thread_st *thread, gearmand_con_st *dcon, gearmand_error_t *ret)59gearman_server_con_st *gearman_server_con_add(gearman_server_thread_st *thread, gearmand_con_st *dcon, gearmand_error_t& ret)
60{60{
61 gearman_server_con_st *con= _server_con_create(thread, dcon, ret);61 gearman_server_con_st *con= _server_con_create(thread, dcon, ret);
62 if (con)62 if (con)
63 {63 {
64 if ((*ret= gearman_io_set_fd(&(con->con), dcon->fd)) != GEARMAND_SUCCESS)64 if ((ret= gearman_io_set_fd(&(con->con), dcon->fd)) != GEARMAND_SUCCESS)
65 {65 {
66 gearman_server_con_free(con);66 gearman_server_con_free(con);
67 return NULL;67 return NULL;
68 }68 }
6969
70 *ret= gearmand_io_set_events(con, POLLIN);70 ret= gearmand_io_set_events(con, POLLIN);
71 if (*ret != GEARMAND_SUCCESS)71 if (ret != GEARMAND_SUCCESS)
72 {72 {
73 gearmand_gerror("gearmand_io_set_events", *ret);73 gearmand_gerror("gearmand_io_set_events", ret);
74 gearman_server_con_free(con);74 gearman_server_con_free(con);
75 return NULL;75 return NULL;
76 }76 }
@@ -81,7 +81,7 @@
8181
82static gearman_server_con_st * _server_con_create(gearman_server_thread_st *thread,82static gearman_server_con_st * _server_con_create(gearman_server_thread_st *thread,
83 gearmand_con_st *dcon,83 gearmand_con_st *dcon,
84 gearmand_error_t *ret)84 gearmand_error_t& ret)
85{85{
86 gearman_server_con_st *con;86 gearman_server_con_st *con;
8787
@@ -95,7 +95,7 @@
95 con= new (std::nothrow) gearman_server_con_st;95 con= new (std::nothrow) gearman_server_con_st;
96 if (con == NULL)96 if (con == NULL)
97 {97 {
98 *ret= gearmand_perror(errno, "new() build_gearman_server_con_st");98 ret= gearmand_perror(errno, "new() build_gearman_server_con_st");
99 return NULL;99 return NULL;
100 }100 }
101 }101 }
@@ -104,7 +104,7 @@
104 if (con == NULL)104 if (con == NULL)
105 {105 {
106 gearmand_error("Neigther an allocated gearman_server_con_st() or free listed could be found");106 gearmand_error("Neigther an allocated gearman_server_con_st() or free listed could be found");
107 *ret= GEARMAND_MEMORY_ALLOCATION_FAILURE;107 ret= GEARMAND_MEMORY_ALLOCATION_FAILURE;
108 return NULL;108 return NULL;
109 }109 }
110110
@@ -148,6 +148,9 @@
148 con->timeout_event= NULL;148 con->timeout_event= NULL;
149149
150 con->protocol= NULL;150 con->protocol= NULL;
151#if defined(HAVE_CYASSL) && HAVE_CYASSL
152 con->_ssl= NULL;
153#endif
151154
152 int error;155 int error;
153 if ((error= pthread_mutex_lock(&thread->lock)) == 0)156 if ((error= pthread_mutex_lock(&thread->lock)) == 0)
@@ -158,7 +161,7 @@
158 gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_lock");161 gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_lock");
159 gearman_server_con_free(con);162 gearman_server_con_free(con);
160163
161 *ret= GEARMAND_ERRNO;164 ret= GEARMAND_ERRNO;
162 return NULL;165 return NULL;
163 }166 }
164 }167 }
@@ -168,7 +171,7 @@
168 gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_lock");171 gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_lock");
169 gearman_server_con_free(con);172 gearman_server_con_free(con);
170173
171 *ret= GEARMAND_ERRNO;174 ret= GEARMAND_ERRNO;
172 return NULL;175 return NULL;
173 }176 }
174177
175178
=== modified file 'libgearman-server/connection.h'
--- libgearman-server/connection.h 2013-03-06 04:50:21 +0000
+++ libgearman-server/connection.h 2013-06-26 23:53:27 +0000
@@ -75,7 +75,7 @@
75 */75 */
76GEARMAN_API76GEARMAN_API
77gearman_server_con_st *gearman_server_con_add(gearman_server_thread_st *thread, gearmand_con_st *dcon,77gearman_server_con_st *gearman_server_con_add(gearman_server_thread_st *thread, gearmand_con_st *dcon,
78 gearmand_error_t *ret);78 gearmand_error_t& ret);
7979
80/**80/**
81 * Attempt to free a server connection structure.81 * Attempt to free a server connection structure.
8282
=== modified file 'libgearman-server/gearmand_con.cc'
--- libgearman-server/gearmand_con.cc 2013-05-05 03:23:55 +0000
+++ libgearman-server/gearmand_con.cc 2013-06-26 23:53:27 +0000
@@ -63,7 +63,7 @@
63 gearmand_con_st *dcon)63 gearmand_con_st *dcon)
64{64{
65 gearmand_error_t ret= GEARMAND_SUCCESS;65 gearmand_error_t ret= GEARMAND_SUCCESS;
66 dcon->server_con= gearman_server_con_add(&(thread->server_thread), dcon, &ret);66 dcon->server_con= gearman_server_con_add(&(thread->server_thread), dcon, ret);
6767
68 assert(dcon->server_con || ret != GEARMAND_SUCCESS);68 assert(dcon->server_con || ret != GEARMAND_SUCCESS);
69 assert(! dcon->server_con || ret == GEARMAND_SUCCESS);69 assert(! dcon->server_con || ret == GEARMAND_SUCCESS);
7070
=== modified file 'libgearman-server/io.cc'
--- libgearman-server/io.cc 2013-06-05 21:59:31 +0000
+++ libgearman-server/io.cc 2013-06-26 23:53:27 +0000
@@ -362,7 +362,6 @@
362 }362 }
363 }363 }
364364
365
366 connection->_state= gearmand_io_st::GEARMAND_CON_UNIVERSAL_INVALID;365 connection->_state= gearmand_io_st::GEARMAND_CON_UNIVERSAL_INVALID;
367 connection->send_state= gearmand_io_st::GEARMAND_CON_SEND_STATE_NONE;366 connection->send_state= gearmand_io_st::GEARMAND_CON_SEND_STATE_NONE;
368 connection->recv_state= gearmand_io_st::GEARMAND_CON_RECV_UNIVERSAL_NONE;367 connection->recv_state= gearmand_io_st::GEARMAND_CON_RECV_UNIVERSAL_NONE;
369368
=== modified file 'libgearman-server/struct/io.h'
--- libgearman-server/struct/io.h 2013-05-11 10:16:19 +0000
+++ libgearman-server/struct/io.h 2013-06-26 23:53:27 +0000
@@ -139,6 +139,9 @@
139 char id[GEARMAND_SERVER_CON_ID_SIZE];139 char id[GEARMAND_SERVER_CON_ID_SIZE];
140 gearmand::protocol::Context* protocol;140 gearmand::protocol::Context* protocol;
141 struct event *timeout_event;141 struct event *timeout_event;
142#if defined(HAVE_CYASSL) && HAVE_CYASSL
143 CYASSL* _ssl;
144#endif
142145
143 gearman_server_con_st()146 gearman_server_con_st()
144 {147 {
@@ -166,7 +169,4 @@
166 protocol= NULL;169 protocol= NULL;
167 }170 }
168 }171 }
169#if defined(HAVE_CYASSL) && HAVE_CYASSL
170 CYASSL* _ssl;
171#endif
172};172};

Subscribers

People subscribed via source and target branches

to all changes: