Commit ad33d466992f59b7d7fda08258242c0171e145f0
1 parent
053cd3d1
Exists in
master
and in
3 other branches
Fixing memory leak when getting CRL from LDAP.
Showing
3 changed files
with
10 additions
and
5 deletions
Show diff stats
lib3270.cbp
... | ... | @@ -12,6 +12,8 @@ |
12 | 12 | <Option object_output=".obj/Debug/" /> |
13 | 13 | <Option type="3" /> |
14 | 14 | <Option compiler="gcc" /> |
15 | + <Option host_application=".bin/Debug/lib3270" /> | |
16 | + <Option run_host_application_in_terminal="0" /> | |
15 | 17 | <Compiler> |
16 | 18 | <Add option="-g" /> |
17 | 19 | </Compiler> |
... | ... | @@ -211,7 +213,10 @@ |
211 | 213 | <Unit filename="src/lib3270/sf.c"> |
212 | 214 | <Option compilerVar="CC" /> |
213 | 215 | </Unit> |
214 | - <Unit filename="src/lib3270/ssl/linux/ctx_init.c"> | |
216 | + <Unit filename="src/lib3270/ssl/ctx_init.c"> | |
217 | + <Option compilerVar="CC" /> | |
218 | + </Unit> | |
219 | + <Unit filename="src/lib3270/ssl/linux/getcrl.c"> | |
215 | 220 | <Option compilerVar="CC" /> |
216 | 221 | </Unit> |
217 | 222 | <Unit filename="src/lib3270/ssl/negotiate.c"> | ... | ... |
src/lib3270/ssl/linux/getcrl.c
... | ... | @@ -267,9 +267,10 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) |
267 | 267 | return NULL; |
268 | 268 | } |
269 | 269 | |
270 | - debug("CRL Length=%d",(int) value[0]->bv_len); | |
270 | + // Precisa salvar uma cópia porque d2i_X509_CRL modifica o ponteiro. | |
271 | + const unsigned char *crl_data = (const unsigned char *) value[0]->bv_val; | |
271 | 272 | |
272 | - if(!d2i_X509_CRL(&crl, (const unsigned char **) &value[0]->bv_val, value[0]->bv_len)) | |
273 | + if(!d2i_X509_CRL(&crl, &crl_data, value[0]->bv_len)) | |
273 | 274 | { |
274 | 275 | message->error = hSession->ssl.error = ERR_get_error(); |
275 | 276 | message->title = N_( "Security error" ); |
... | ... | @@ -277,7 +278,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) |
277 | 278 | lib3270_write_log(hSession,"ssl","%s: %s",url, message->text); |
278 | 279 | } |
279 | 280 | |
280 | - // ldap_value_free_len(value); | |
281 | + ldap_value_free_len(value); | |
281 | 282 | |
282 | 283 | } |
283 | 284 | #endif // HAVE_LDAP | ... | ... |
src/lib3270/trace_ds.c
... | ... | @@ -183,7 +183,6 @@ void trace_ssl(H3270 *session, const char *fmt, ...) |
183 | 183 | { |
184 | 184 | va_list args; |
185 | 185 | |
186 | - debug("******************* %d",(int) lib3270_get_toggle(session,LIB3270_TOGGLE_SSL_TRACE)); | |
187 | 186 | if (!lib3270_get_toggle(session,LIB3270_TOGGLE_SSL_TRACE)) |
188 | 187 | return; |
189 | 188 | ... | ... |