diff --git a/src/parser.c b/src/parser.c index 8c94dc6b..5006e8a5 100644 --- a/src/parser.c +++ b/src/parser.c @@ -136,6 +136,10 @@ static loc_cmd* get_loc_cmd(char c, char* line) { lcmd->unum_size++; } lcmd->unum = (uint32_t*)malloc(lcmd->unum_size * sizeof(uint32_t)); + if (lcmd->unum == NULL) { + luprint("could not allocate memory"); + goto err; + } token = strtok(&line[i], ".,"); for (l=0; (lunum_size) && (token != NULL); l++) { lcmd->unum[l] = (int32_t)strtol(token, &endptr, 0); @@ -1238,6 +1242,8 @@ char* replace_char(const char* src, const char c, const char* rep) count++; } res = (char*)malloc(str_len + count*rep_len + 1); + if (res == NULL) + return NULL; for (i=0,j=0; i