Fixed all invalid mmeory accesses

This commit is contained in:
Dale Weiler 2012-04-28 06:31:16 -04:00
parent b09d75518c
commit 1d6594a491
3 changed files with 6 additions and 12 deletions

4
asm.c
View file

@ -161,10 +161,6 @@ static inline bool asm_parse_func(const char *skip, size_t line, asm_state *stat
mem_d(name); mem_d(name);
return false; return false;
} }
/* reassign name */
mem_d(name);
name = util_strchp(name, strchr(name, ','));
/* /*
* Now add the following items to the code system: * Now add the following items to the code system:
* function * function

2
main.c
View file

@ -155,7 +155,7 @@ int main(int argc, char **argv) {
for (itr = 0; itr < items_elements; itr++) for (itr = 0; itr < items_elements; itr++)
mem_d(items_data[itr].name); mem_d(items_data[itr].name);
mem_d(items_data); mem_d(items_data);
util_meminfo(); util_meminfo();
return 0; return 0;
} }

12
util.c
View file

@ -126,14 +126,12 @@ char *util_strrq(const char *s) {
char *util_strchp(const char *s, const char *e) { char *util_strchp(const char *s, const char *e) {
if (!s || !e) if (!s || !e)
return NULL; return NULL;
const char *c = s;
while (c != e)
c++;
size_t m = 0; return util_strdup(s);
char *c = util_strdup(s);
while (s != e)
s++,c++,m++;
*c = '\0';
return c-m;
} }
/* /*