putenv() does not copy the supplied environment stringi, but gcc/gnat was free()ing the memory expecting that it would be copied.