serious mem leak
takakawa opened this issue · comments
takakawa commented
I have read the code,and find that there are many memory leak in it.
Such As some code in url_parse :
char *search = malloc(sizeof(search));
if (!search) return NULL; // you should not just return NULL,you should free previou malloced memroy
tmp_path = strff(tmp_path, pathname_len);
strcat(search, "");
sscanf(tmp_path, "%[^#]", search);
data->search = search;
int search_len = strlen(search);
free(tmp_path);
char *query = malloc(sizeof(char));
if (!query) return NULL; // you should not just return NULL,you should free previou malloced memroy
sscanf(search, "?%s", query);
data->query = query;
char *hash = malloc(sizeof(char));
if (!hash) return NULL; // you should not just return NULL,you should free previou malloced memroy
Lars H. Rohwedder commented
The memory leaks are fixed now.