From: Augustin Degomme Date: Thu, 18 Jul 2013 11:42:03 +0000 (+0200) Subject: guard against potential segfault when used before initialization X-Git-Tag: v3_9_90~128^2~55 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/1cd4e2c4bba73096cec2e10f165ae0c84bf36590?ds=sidebyside guard against potential segfault when used before initialization --- diff --git a/src/xbt/xbt_os_thread.c b/src/xbt/xbt_os_thread.c index f435231bbe..ae4bc9b435 100644 --- a/src/xbt/xbt_os_thread.c +++ b/src/xbt/xbt_os_thread.c @@ -1234,7 +1234,8 @@ void xbt_os_thread_set_extra_data(void *data) void *xbt_os_thread_get_extra_data(void) { - return xbt_os_thread_self()->extra_data; + xbt_os_thread_t self = xbt_os_thread_self(); + return self? self->extra_data : NULL; } xbt_os_rmutex_t xbt_os_rmutex_init(void)