diff options
-rw-r--r-- | lib/Exceptions.cc | 2 | ||||
-rw-r--r-- | lib/Image.cc | 4 | ||||
-rw-r--r-- | lib/Input.cc | 5 |
3 files changed, 10 insertions, 1 deletions
diff --git a/lib/Exceptions.cc b/lib/Exceptions.cc index 1ff8b6a..e9c5861 100644 --- a/lib/Exceptions.cc +++ b/lib/Exceptions.cc @@ -124,11 +124,13 @@ void * xrealloc(void * ptr, size_t s) { void xfree(unsigned char *& p) { char * t = (char *) p; xfree(t); + p = 0; } void xfree(void *& p) { char * t = (char *) p; xfree(t); + p = 0; } void xfree(char *& p) { diff --git a/lib/Image.cc b/lib/Image.cc index ad986f6..2e33da7 100644 --- a/lib/Image.cc +++ b/lib/Image.cc @@ -9,7 +9,9 @@ Image::Image(unsigned int ax, unsigned int ay) : x(ax), y(ay), img((Color *) mal } Image::~Image() { - free((void *)img); + char * t = (char *) img; + free(t); + img = 0; } bool Image::CanWrite() const { diff --git a/lib/Input.cc b/lib/Input.cc index 719c560..c7cd1d9 100644 --- a/lib/Input.cc +++ b/lib/Input.cc @@ -7,6 +7,11 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#else +#include <io.h> +#endif #include "Input.h" #include "Exceptions.h" #include "gettext.h" |