[wesnoth-commits] [wesnoth/wesnoth] 8322ef: Fix parser opens tmp file 2 times then crashes

Lovens Weche noreply at github.com
Thu Feb 21 19:18:51 UTC 2019


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 8322efa978ca8cbb0a64a1c48207c1bf579274d1
      https://github.com/wesnoth/wesnoth/commit/8322efa978ca8cbb0a64a1c48207c1bf579274d1
  Author: Lovens Weche <lweche159 at gmail.com>
  Date:   2019-02-19 (Tue, 19 Feb 2019)

  Changed paths:
    M data/tools/wesnoth/wmlparser3.py

  Log Message:
  -----------
  Fix parser opens tmp file 2 times then crashes

When parsing binary data in the wmlparser3 script, a temporary file is
created and opened. The problem is that the temporary file is never
closed and in subsequent functions it is reopened.

The solution is first, create a list of temporary file paths to delete at
program’s exit. In the atexit’s registered cleaning function, all the
files in this list are deleted.

Then in the function that creates the temporary file, we simply close
the file after the binary data has been written in it.

Closes #3927


  Commit: 44e9d247c3e553d199a6b9bba9117e4bc54f4725
      https://github.com/wesnoth/wesnoth/commit/44e9d247c3e553d199a6b9bba9117e4bc54f4725
  Author: Lovens Weche <lweche159 at gmail.com>
  Date:   2019-02-21 (Thu, 21 Feb 2019)

  Changed paths:
    M data/tools/wesnoth/wmlparser3.py

  Log Message:
  -----------
  Merge pull request #3930 from LovCAPONE/bug_3927_fix

Fix parser opens tmp file 2 times then crashes


Compare: https://github.com/wesnoth/wesnoth/compare/5f0be6cd9899...44e9d247c3e5



More information about the Commits mailing list