X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8d0eaea75f444b5ac20edfca6d4ce04cee7307e7..cf6462fa490b741ba5c0b5fd6bb64838d9093fd1:/src/simdag/sd_link.c diff --git a/src/simdag/sd_link.c b/src/simdag/sd_link.c index fcfc57858f..e130213202 100644 --- a/src/simdag/sd_link.c +++ b/src/simdag/sd_link.c @@ -28,7 +28,7 @@ void* SG_link_get_data(SG_link_t link) { return link->data; } -/* Sets the user data of a link. The data can be NULL. +/* Sets the user data of a link. The new data can be NULL. The old data should have been freed first if it was not NULL. */ void SG_link_set_data(SG_link_t link, void *data) { xbt_assert0(link, "Invalid parameter"); @@ -75,7 +75,10 @@ double SG_link_get_current_latency(SG_link_t link) { void __SG_link_destroy(SG_link_t link) { xbt_assert0(link, "Invalid parameter"); - if (link->name) + if (link->sgdata != NULL) + xbt_free(link->sgdata); + + if (link->name != NULL) xbt_free(link->name); xbt_free(link);