From cc3955c44521a7c4c70bbab87d5a8e33ae450d94 Mon Sep 17 00:00:00 2001 From: Allanis Date: Mon, 10 Mar 2014 16:20:56 +0000 Subject: [PATCH] [Fix] Should remove the majority of Valgrind errors. --- src/ai.c | 1 + src/map.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ai.c b/src/ai.c index 3ec9f23..b157de3 100644 --- a/src/ai.c +++ b/src/ai.c @@ -1025,6 +1025,7 @@ static int ai_face(lua_State* L) { vect_cset(&tv, VX(p->solid->pos), VY(p->solid->pos)); lv = NULL; } + else LLUA_INVALID_PARAMETER(); } else if(lua_isvector(L, 1)) lv = lua_tovector(L, 1); diff --git a/src/map.c b/src/map.c index ed87c97..6fb3100 100644 --- a/src/map.c +++ b/src/map.c @@ -223,9 +223,10 @@ static void map_update(unsigned int wid) { } /* Get planets. */ - if(sys->nplanets == 0) - window_modifyText(wid, "txtPlanets", "None"); - else { + if(sys->nplanets == 0) { + strncpy(buf, "None", 128); + window_modifyText(wid, "txtPlanets", buf); + } else { buf[0] = '\0'; if(sys->nplanets > 0) strcat(buf, sys->planets[0]->name);