Commit 1294de607270eb9bacf4e38771d21765f7fb516c

Authored by Perry Werneck
1 parent 82810a20

Ajustes em função de teste com valgrind.

src/lib3270/ctlr.c
@@ -142,9 +142,8 @@ void ctlr_reinit(H3270 *session, unsigned cmask) @@ -142,9 +142,8 @@ void ctlr_reinit(H3270 *session, unsigned cmask)
142 session->buffer[1] = tmp = lib3270_calloc(sizeof(struct lib3270_ea),sz+1,session->buffer[1]); 142 session->buffer[1] = tmp = lib3270_calloc(sizeof(struct lib3270_ea),sz+1,session->buffer[1]);
143 session->aea_buf = tmp + 1; 143 session->aea_buf = tmp + 1;
144 144
145 - session->text = lib3270_calloc(sizeof(struct lib3270_text),sz,session->text);  
146 -  
147 - Replace(session->zero_buf, (unsigned char *)Calloc(sizeof(struct lib3270_ea),sz)); 145 + session->text = lib3270_calloc(sizeof(struct lib3270_text),sz,session->text);
  146 + session->zero_buf = lib3270_calloc(sizeof(struct lib3270_ea),sz,session->zero_buf);
148 147
149 session->cursor_addr = 0; 148 session->cursor_addr = 0;
150 session->buffer_addr = 0; 149 session->buffer_addr = 0;
@@ -247,23 +246,6 @@ const char * lib3270_get_model(H3270 *hSession) @@ -247,23 +246,6 @@ const char * lib3270_get_model(H3270 *hSession)
247 return hSession->model_name; 246 return hSession->model_name;
248 } 247 }
249 248
250 -/**  
251 - * Deal with the relationships between model numbers and rows/cols.  
252 - *  
253 - * @param hSession Session handle.  
254 - * @param model New model (updates model name)  
255 - */ /*  
256 -int lib3270_set_model(H3270 *hSession, int model)  
257 -{  
258 - if(CONNECTED)  
259 - return EBUSY;  
260 -  
261 - ctlr_set_rows_cols(hSession,model,hSession->ov_cols,hSession->ov_rows);  
262 - ctlr_reinit(hSession,MODEL_CHANGE);  
263 - screen_update(hSession,0,hSession->rows*hSession->cols);  
264 - return 0;  
265 -} */  
266 -  
267 int lib3270_set_model(H3270 *hSession, const char *model) 249 int lib3270_set_model(H3270 *hSession, const char *model)
268 { 250 {
269 int ovc, ovr; 251 int ovc, ovr;
src/lib3270/screenc.h
@@ -39,10 +39,6 @@ @@ -39,10 +39,6 @@
39 #define display_height() 1 39 #define display_height() 1
40 #define display_widthMM() 100 40 #define display_widthMM() 100
41 #define display_width() 1 41 #define display_width() 1
42 -// #define screen_obscured() False  
43 -// #define screen_scroll() screen_disp()  
44 -// #define screen_132() /* */  
45 -// #define screen_80() /* */  
46 42
47 LIB3270_INTERNAL int screen_init(H3270 *session); 43 LIB3270_INTERNAL int screen_init(H3270 *session);
48 // LIB3270_INTERNAL Boolean screen_new_display_charsets(char *cslist, char *csname); 44 // LIB3270_INTERNAL Boolean screen_new_display_charsets(char *cslist, char *csname);
src/lib3270/ssl.c
@@ -95,19 +95,22 @@ int ssl_negotiate(H3270 *hSession) @@ -95,19 +95,22 @@ int ssl_negotiate(H3270 *hSession)
95 95
96 if (rv != 1) 96 if (rv != 1)
97 { 97 {
98 - int ssl_error = SSL_get_error(hSession->ssl_con,rv); 98 + int ssl_error = SSL_get_error(hSession->ssl_con,rv);
  99 + const char * msg = "";
99 100
100 if(ssl_error == SSL_ERROR_SYSCALL && hSession->ssl_error) 101 if(ssl_error == SSL_ERROR_SYSCALL && hSession->ssl_error)
101 ssl_error = hSession->ssl_error; 102 ssl_error = hSession->ssl_error;
102 103
103 - trace_dsn(hSession,"SSL_connect failed: %s %s\n",ERR_lib_error_string(hSession->ssl_error),ERR_reason_error_string(hSession->ssl_error)); 104 + msg = ERR_lib_error_string(ssl_error);
  105 +
  106 + trace_dsn(hSession,"SSL_connect failed: %s %s\n",msg,ERR_reason_error_string(hSession->ssl_error));
104 107
105 lib3270_popup_dialog( 108 lib3270_popup_dialog(
106 hSession, 109 hSession,
107 LIB3270_NOTIFY_ERROR, 110 LIB3270_NOTIFY_ERROR,
108 N_( "Security error" ), 111 N_( "Security error" ),
109 N_( "SSL Connect failed" ), 112 N_( "SSL Connect failed" ),
110 - "%s",ERR_lib_error_string(ssl_error) 113 + "%s",msg ? msg : ""
111 ); 114 );
112 115
113 lib3270_disconnect(hSession); 116 lib3270_disconnect(hSession);
src/lib3270/telnet.c
@@ -996,6 +996,8 @@ void net_input(H3270 *hSession, int fd, LIB3270_IO_FLAG flag, void *dunno) @@ -996,6 +996,8 @@ void net_input(H3270 *hSession, int fd, LIB3270_IO_FLAG flag, void *dunno)
996 996
997 CHECK_SESSION_HANDLE(hSession); 997 CHECK_SESSION_HANDLE(hSession);
998 998
  999 + memset(buffer,0,BUFSZ);
  1000 +
999 #if defined(_WIN32) 1001 #if defined(_WIN32)
1000 for (;;) 1002 for (;;)
1001 #endif 1003 #endif
src/lib3270/valgrind.suppression
@@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
  1 +{
  2 + addch
  3 + Memcheck:Cond
  4 + fun:addch
  5 + fun:screen_update
  6 + fun:screen_disp
  7 + fun:status_reset
  8 + fun:defer_unlock
  9 + fun:lib3270_default_event_dispatcher
  10 + fun:lib3270_main_iterate
  11 + fun:mainloop
  12 + fun:main
  13 +}
  14 +