Mercurial > sdl-ios-xcode
annotate Makefile.minimal @ 4158:96ce26f24b01 SDL-1.2
Date: Sun, 7 Sep 2008 15:17:00 +0200
From: c2woody@gmx.net
Subject: [SDL] SDL 1.2 doube free/pointer zeroing missing
Hello,
this is about a crash/debug breakage for the current SDL 1.2
source tree (today's svn checkout, same problem in 1.2.13 and
before as far as relevant).
In some places memory is free()d but the associated pointer
is not zeroed, leading to for example double free()s.
For me this happened because SDL_StopEventThread() was executed
twice (during restart of the subsystems), once for the close
down in SDL_VideoQuit() and once at the startup, right at the
beginning of SDL_StartEventLoop(). Thus the code
SDL_DestroyMutex(SDL_EventQ.lock);
(see SDL_events.c) was called twice and executed the SDL_free(mutex);
twice as well, leading to a crash (msvc 64bit for which it was noticed).
I've tried to check all other occurrences of SDL_free and similar
code in msvc, see the attached patch (udiff against revision 4082).
Non-windows only codepaths have neither been checked nor touched.
Comments/ideas welcome.
Attached patch: NULLifies some pointers after they have been free()d.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 12 Nov 2008 17:23:40 +0000 |
parents | 64710b9f3eeb |
children | a72a5f62d6b7 |
rev | line source |
---|---|
1484
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 # Makefile to build the SDL library |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3 INCLUDE = -I./include |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 CFLAGS = -g -O2 $(INCLUDE) |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 AR = ar |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 RANLIB = ranlib |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 |
1603 | 8 CONFIG_H = include/SDL_config.h |
1484
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 TARGET = libSDL.a |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 SOURCES = \ |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 src/*.c \ |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 src/audio/*.c \ |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 src/cdrom/*.c \ |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 src/cpuinfo/*.c \ |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 src/events/*.c \ |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 src/file/*.c \ |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 src/joystick/*.c \ |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 src/stdlib/*.c \ |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 src/thread/*.c \ |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 src/timer/*.c \ |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 src/video/*.c \ |
1533
38c1eb6b0083
By default all the real targets have dummy audio/video and disk audio.
Sam Lantinga <slouken@libsdl.org>
parents:
1484
diff
changeset
|
22 src/audio/dummy/*.c \ |
1484
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 src/video/dummy/*.c \ |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 src/joystick/dummy/*.c \ |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 src/cdrom/dummy/*.c \ |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 src/thread/generic/*.c \ |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 src/timer/dummy/*.c \ |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 src/loadso/dummy/*.c \ |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g') |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 all: $(TARGET) |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 |
1603 | 34 $(TARGET): $(CONFIG_H) $(OBJECTS) |
1484
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 $(AR) crv $@ $^ |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 $(RANLIB) $@ |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 |
1603 | 38 $(CONFIG_H): |
39 cp $(CONFIG_H).default $(CONFIG_H) | |
40 | |
1484
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 clean: |
b2b476a4a73c
Added documentation on how to build a completely useless SDL library. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 rm -f $(TARGET) $(OBJECTS) |