Commit 35d826aa300d82dc25689f39ee0e6b67b4a3c81c
1 parent
a31b6734
Exists in
master
and in
3 other branches
Corrigindo segfaults aleatorios em windows 64
Showing
2 changed files
with
13 additions
and
7 deletions
Show diff stats
screen.c
... | ... | @@ -264,6 +264,7 @@ void update_model_info(H3270 *session, int model, int cols, int rows) |
264 | 264 | /* Update the model name. */ |
265 | 265 | (void) sprintf(session->model_name, "327%c-%d%s",session->m3279 ? '9' : '8',session->model_num,session->extended ? "-E" : ""); |
266 | 266 | |
267 | + trace("%s: %p",__FUNCTION__,session->update_model); | |
267 | 268 | session->update_model(session, session->model_name,session->model_num,rows,cols); |
268 | 269 | } |
269 | 270 | |
... | ... | @@ -634,7 +635,12 @@ void Error(H3270 *session, const char *fmt, ...) |
634 | 635 | trace("%s: title=%s fmt=%s",__FUNCTION__,"3270 Error",fmt); |
635 | 636 | |
636 | 637 | va_start(arg_ptr, fmt); |
637 | - popup_handler(session,session->widget,LIB3270_NOTIFY_ERROR, _( "3270 Error" ),NULL,fmt,arg_ptr); | |
638 | + | |
639 | + if(session && session->sz == sizeof(H3270)) | |
640 | + popup_handler(session,session->widget,LIB3270_NOTIFY_ERROR, _( "3270 Error" ),NULL,fmt,arg_ptr); | |
641 | + else | |
642 | + popup_handler(NULL,NULL,LIB3270_NOTIFY_ERROR, _( "3270 Error" ),NULL,fmt,arg_ptr); | |
643 | + | |
638 | 644 | va_end(arg_ptr); |
639 | 645 | |
640 | 646 | } | ... | ... |
util.c
... | ... | @@ -167,8 +167,8 @@ char * xs_vsprintf(const char *fmt, va_list args) |
167 | 167 | char *r; |
168 | 168 | #if defined(HAVE_VASPRINTF) /*[*/ |
169 | 169 | (void) vasprintf(&r, fmt, args); |
170 | - if (r == CN) | |
171 | - Error("Out of memory"); | |
170 | + if(!r) | |
171 | + Error(NULL,"Out of memory in %s",__FUNCTION__); | |
172 | 172 | return r; |
173 | 173 | #else /*][*/ |
174 | 174 | char buf[16384]; |
... | ... | @@ -1098,7 +1098,7 @@ LIB3270_EXPORT void * lib3270_realloc(void *p, int len) |
1098 | 1098 | { |
1099 | 1099 | p = realloc(p, len); |
1100 | 1100 | if(!p) |
1101 | - Error(NULL,"Out of memory"); | |
1101 | + Error(NULL,"Out of memory in %s",__FUNCTION__); | |
1102 | 1102 | return p; |
1103 | 1103 | } |
1104 | 1104 | |
... | ... | @@ -1114,7 +1114,7 @@ LIB3270_EXPORT void * lib3270_calloc(int elsize, int nelem, void *ptr) |
1114 | 1114 | if(ptr) |
1115 | 1115 | memset(ptr,0,sz); |
1116 | 1116 | else |
1117 | - Error(NULL,"Out of memory"); | |
1117 | + Error(NULL,"Out of memory in %s",__FUNCTION__); | |
1118 | 1118 | |
1119 | 1119 | return ptr; |
1120 | 1120 | } |
... | ... | @@ -1127,7 +1127,7 @@ LIB3270_EXPORT void * lib3270_malloc(int len) |
1127 | 1127 | r = malloc(len); |
1128 | 1128 | if (r == (char *)NULL) |
1129 | 1129 | { |
1130 | - Error(NULL,"Out of memory"); | |
1130 | + Error(NULL,"Out of memory in %s",__FUNCTION__); | |
1131 | 1131 | return 0; |
1132 | 1132 | } |
1133 | 1133 | |
... | ... | @@ -1142,7 +1142,7 @@ void * Calloc(size_t nelem, size_t elsize) |
1142 | 1142 | char * r = malloc(sz); |
1143 | 1143 | |
1144 | 1144 | if(!r) |
1145 | - Error(NULL,"Out of memory"); | |
1145 | + Error(NULL,"Out of memory in %s",__FUNCTION__); | |
1146 | 1146 | |
1147 | 1147 | memset(r, 0, sz); |
1148 | 1148 | return r; | ... | ... |