Permalink
Browse files

Memory leaks and delete operator fixes.

(pull request #168)
  • Loading branch information...
devnexen authored and ac-stef committed Mar 26, 2017
1 parent 419f667 commit 333550895561e182d4a18c8872b1c76d27df4961
Showing with 8 additions and 3 deletions.
  1. +5 −1 source/src/crypto.cpp
  2. +1 −0 source/src/main.cpp
  3. +1 −1 source/src/stream.cpp
  4. +1 −1 source/src/worldio.cpp
View
@@ -985,6 +985,10 @@ void authkey_(char **args, int numargs) // set up misc keys
}
conoutf("authkey %s generated.", ak->name);
}
else
{
delete ak;
}
}
}
else if(!strcasecmp(args[0], "ADD"))
@@ -993,7 +997,7 @@ void authkey_(char **args, int numargs) // set up misc keys
{
delauthkey(args[1]);
authkey *ak = new authkey(args[1], args[2]);
if(ak->name) authkeys.add(ak);
if(ak->name) authkeys.add(ak); else delete ak;
}
}
else if(!strcasecmp(args[0], "SELFCERT"))
View
@@ -298,6 +298,7 @@ void mapscreenshot(const char *imagepath, bool mapshot, int fileformat)
{
conoutf("no mapshot prepared!");
SDL_FreeSurface(image);
delete[] tmpdst;
return;
}
loopi(dst_h)
View
@@ -934,7 +934,7 @@ stream *opengzfile(const char *filename, const char *mode, stream *file, int lev
stream *source = file ? file : openfile(filename, mode);
if(!source) return NULL;
gzstream *gz = new gzstream;
if(!gz->open(source, mode, !file, level)) { if(!file) delete source; return NULL; }
if(!gz->open(source, mode, !file, level)) { if(!file) delete source; delete gz; return NULL; }
return gz;
}
View
@@ -1149,7 +1149,7 @@ struct xmap
~xmap()
{
headerextras.deletecontents();
delete world;
delete[] world;
ents.setsize(0);
delents.setsize(0);
mapconfig.setsize(0);

0 comments on commit 3335508

Please sign in to comment.