Skip to content
Browse files

Minor cleanup.

Fixed a linked-list memory leak.
Updated listiterator after deletion of rocket which could cause crash.
Removed inclusion of windows.h, not needed.
  • Loading branch information...
1 parent 6a88b22 commit 0062a7b8f0a9da49e2be3ba0dc67695cb4843ea8 @DusteDdk committed Sep 21, 2012
Showing with 3 additions and 7 deletions.
  1. +2 −1 list.c
  2. +0 −5 platform/pc.h
  3. +1 −1 stars.c
View
3 list.c
@@ -89,14 +89,15 @@ listItem* listRemoveItem(listItem* start, listItem* item)
if(l->next)
{
prev->next=l->next;
- free(item);
} else {
prev->next=0;
}
+ free(item);
return(prev);
}
prev=l;
}
+ printf("listRemoveItem ERROR: no item (%p) found in list (%p)!\n");
return(0);
}
View
5 platform/pc.h
@@ -27,11 +27,6 @@
#if defined(WIN32)
#if defined(WITH_OPENGL)
#define GLEW_STATIC
- #define WINDOWS_LEAN_AND_MEAN
- #define NOMINMAX
- #ifndef WIN32_CROSS
- #include <windows.h> //Seems like windows.h is not needed for mingw32-cross compiling.
- #endif
#include <GL/glew.h>
#endif
View
2 stars.c
@@ -206,7 +206,7 @@ void fireWorks(SDL_Surface* screen)
//Remove rocket
free(it->data);
- listRemoveItem(rockets, it);
+ it=listRemoveItem(rockets, it);
}
} //Sim rocket stars
} //iterate through rockets

0 comments on commit 0062a7b

Please sign in to comment.
Something went wrong with that request. Please try again.