File: heroeslvl-segfault.patch

package info (click to toggle)
heroes 0.21-21
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,796 kB
  • sloc: ansic: 27,951; sh: 3,941; makefile: 651; yacc: 318; sed: 51; lisp: 10; perl: 9
file content (24 lines) | stat: -rw-r--r-- 720 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Description: Avoid segfaulting in lvl_free()
Author: Stephen Kitt <skitt@debian.org>
Bug-Debian: https://bugs.debian.org/716016
Last-Update: 2016-01-21

--- heroes-0.21.orig/src/lvl/free.c
+++ heroes-0.21/src/lvl/free.c
@@ -24,10 +24,12 @@
 void
 lvl_free (a_level *lvl)
 {
-  XFREE0 (lvl->private->tile);
-  XFREE0 (lvl->private->sound_track_alias);
-  XFREE0 (lvl->private->tile_sprite_map_basename);
-  XFREE0 (lvl->private);
+  if (lvl->private) {
+    XFREE0 (lvl->private->tile);
+    XFREE0 (lvl->private->sound_track_alias);
+    XFREE0 (lvl->private->tile_sprite_map_basename);
+    XFREE0 (lvl->private);
+  }
   XFREE0 (lvl->square_type);
   XFREE0 (lvl->square_walls_out);
   XFREE0 (lvl->square_direction);