diff --git a/source/src/rendergl.cpp b/source/src/rendergl.cpp index 979c8c05..58aafa41 100644 --- a/source/src/rendergl.cpp +++ b/source/src/rendergl.cpp @@ -74,7 +74,12 @@ GLuint installtex(const char *texname, int &xs, int &ys, bool clamp) { SDL_Surface *s = IMG_Load(texname); if(!s) { conoutf("couldn't load texture %s", texname); return 0; }; - if(s->format->BitsPerPixel!=24 && s->format->BitsPerPixel!=32) { conoutf("texture must be 24bpp or 32bpp: %s", texname); return 0; }; + if(s->format->BitsPerPixel!=24 && s->format->BitsPerPixel!=32) + { + SDL_FreeSurface(s); + conoutf("texture must be 24bpp or 32bpp: %s", texname); + return 0; + }; // loopi(s->w*s->h*3) { uchar *p = (uchar *)s->pixels+i; *p = 255-*p; }; GLuint tnum; glGenTextures(1, &tnum); diff --git a/source/src/sound.cpp b/source/src/sound.cpp index 0c864ad8..041a56b0 100644 --- a/source/src/sound.cpp +++ b/source/src/sound.cpp @@ -94,9 +94,7 @@ void music(char *name) stopsound(); if(soundvol && musicvol) { - string sn; - s_strcpy(sn, "packages/audio/songs/"); - s_strcat(sn, name); + s_sprintfd(sn)("packages/audio/songs/%s", name); #ifdef USE_MIXER if((mod = Mix_LoadMUS(path(sn)))) { diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index 29fefb1e..c2d0149a 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -475,7 +475,7 @@ void shorten(vec &from, vec &to, vec &target) void raydamage(vec &from, vec &to, playerent *d) { - int i = -1, gdam = guns[d->gunselect].damage;; + int i = -1, gdam = guns[d->gunselect].damage; playerent *o = NULL; if(d->gunselect==GUN_SHOTGUN) {