From: Dale Weiler Date: Sat, 28 Apr 2012 10:31:16 +0000 (-0400) Subject: Fixed all invalid mmeory accesses X-Git-Tag: 0.1-rc1~568 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1d6594a4913ee02c25e352391ed0a1d353a3a7de;p=xonotic%2Fgmqcc.git Fixed all invalid mmeory accesses --- diff --git a/asm.c b/asm.c index 71a8fa3..573da33 100644 --- a/asm.c +++ b/asm.c @@ -161,10 +161,6 @@ static inline bool asm_parse_func(const char *skip, size_t line, asm_state *stat mem_d(name); return false; } - /* reassign name */ - mem_d(name); - name = util_strchp(name, strchr(name, ',')); - /* * Now add the following items to the code system: * function diff --git a/main.c b/main.c index 475053e..67e0b0c 100644 --- a/main.c +++ b/main.c @@ -155,7 +155,7 @@ int main(int argc, char **argv) { for (itr = 0; itr < items_elements; itr++) mem_d(items_data[itr].name); mem_d(items_data); - + util_meminfo(); return 0; } diff --git a/util.c b/util.c index 95736e1..7cf7812 100644 --- a/util.c +++ b/util.c @@ -126,14 +126,12 @@ char *util_strrq(const char *s) { char *util_strchp(const char *s, const char *e) { if (!s || !e) return NULL; + + const char *c = s; + while (c != e) + c++; - size_t m = 0; - char *c = util_strdup(s); - while (s != e) - s++,c++,m++; - - *c = '\0'; - return c-m; + return util_strdup(s); } /*