Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid to use the data after freeing them, even in error reporting
[simgrid.git] / src / xbt / config.c
index 6f42ce9..e6a802e 100644 (file)
@@ -575,6 +575,8 @@ xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options) {
     TRY {
       variable = xbt_dict_get((xbt_dict_t)cfg,name);
     } CATCH(e) {
     TRY {
       variable = xbt_dict_get((xbt_dict_t)cfg,name);
     } CATCH(e) {
+      /* put it back on what won't get freed, ie within "options" and out of "optionlist_cpy" */
+      name = (char*) (optionlist_cpy-name + options); 
       free(optionlist_cpy);
       if (e.category == not_found_error) {
        xbt_ex_free(e);
       free(optionlist_cpy);
       if (e.category == not_found_error) {
        xbt_ex_free(e);