]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Fixed all invalid mmeory accesses
authorDale Weiler <killfieldengine@gmail.com>
Sat, 28 Apr 2012 10:31:16 +0000 (06:31 -0400)
committerDale Weiler <killfieldengine@gmail.com>
Sat, 28 Apr 2012 10:31:16 +0000 (06:31 -0400)
asm.c
main.c
util.c

diff --git a/asm.c b/asm.c
index 71a8fa37b91fa3f99b0c4c9896179c7395355b64..573da3309c14d336dbde13e8b9a8d6e88e22e053 100644 (file)
--- 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 475053e701282687f30434bc851d780a0fe579a3..67e0b0c677980528fd93c47d363b3618738c9473 100644 (file)
--- 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 95736e133f9221b42868d6860144b94c05fa6248..7cf781212d9a822241b1348c645a54d489a44643 100644 (file)
--- 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);
 }
 
 /*