From: mquinson Date: Wed, 18 Aug 2004 19:55:23 +0000 (+0000) Subject: Specify the buffer size before allocating them, to avoid the pain of malloc(0) X-Git-Tag: v3.3~4967 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/7b96679cda31be219b57abab02cc75bedebe5b00?ds=sidebyside Specify the buffer size before allocating them, to avoid the pain of malloc(0) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@383 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/gras/Transport/transport_plugin_buf.c b/src/gras/Transport/transport_plugin_buf.c index 6045943bbb..22d7ae6742 100644 --- a/src/gras/Transport/transport_plugin_buf.c +++ b/src/gras/Transport/transport_plugin_buf.c @@ -73,6 +73,9 @@ gras_error_t gras_trp_buf_init_sock(gras_socket_t *sock) { if (!data) RAISE_MALLOC; data->in.size = 0; + // data->buffsize = 32 * 1024 - 4; /* default socket buffsize (32k) - headers */ + data->buffsize = 100 * 1024 ; /* 100k */ + if (!(data->in.data = malloc(data->buffsize))) RAISE_MALLOC; data->in.pos = 0; /* useless, indeed, since size==pos */ @@ -80,8 +83,6 @@ gras_error_t gras_trp_buf_init_sock(gras_socket_t *sock) { if (!(data->out.data = malloc(data->buffsize))) RAISE_MALLOC; data->out.pos = 0; - // data->buffsize = 32 * 1024 - 4; /* default socket buffsize (32k) - headers */ - data->buffsize = 100 * 1024 ; /* 100k */ sock->bufdata = data; return no_error; }