From: mquinson Date: Wed, 21 May 2008 08:42:02 +0000 (+0000) Subject: do not try to malloc 0-sized arrays X-Git-Tag: v3.3~465 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/3b1a306fd49277f2ee84b9bb9dbfdff69762734e do not try to malloc 0-sized arrays git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5471 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/msg/host.c b/src/msg/host.c index 9c286302ac..af47296154 100644 --- a/src/msg/host.c +++ b/src/msg/host.c @@ -45,8 +45,9 @@ m_host_t __MSG_host_create(smx_host_t workstation, void *data) host->data = data; simdata->smx_host = workstation; - - simdata->mailboxes = xbt_new0(msg_mailbox_t, msg_global->max_channel); + + if (msg_global->max_channel>0) + simdata->mailboxes = xbt_new0(msg_mailbox_t, msg_global->max_channel); for (i = 0; i < msg_global->max_channel; i++) { @@ -151,7 +152,8 @@ void __MSG_host_destroy(m_host_t host) memset(alias,0,MAX_ALIAS_NAME +1); } - free(simdata->mailboxes); + if (msg_global->max_channel>0) + free(simdata->mailboxes); SIMIX_mutex_destroy(simdata->mutex); free(simdata);