aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/net/util.c5
-rw-r--r--src/types/str.c2
-rw-r--r--src/util.c7
3 files changed, 10 insertions, 4 deletions
diff --git a/src/net/util.c b/src/net/util.c
index 866e931..bada160 100644
--- a/src/net/util.c
+++ b/src/net/util.c
@@ -414,7 +414,10 @@ void parse_mimetypes(){
mime_type = map_init();
FILE* fp = fopen(_mimetypes, "r");
- if(fp == NULL) return (void)printf("unable to load mimetypes, set llby.net.mimetypes to a proper location, or nil to skip this\n");
+ if(fp == NULL){
+ fprintf(stderr, "unable to load mimetypes, set llby.net.mimetypes to a proper location, or nil to skip this\n");
+ return;
+ }
char* line = NULL;
size_t len = 0;
diff --git a/src/types/str.c b/src/types/str.c
index 9799367..e673473 100644
--- a/src/types/str.c
+++ b/src/types/str.c
@@ -35,7 +35,7 @@ str* str_init(const char* init){
void str_free(str* s){
free(s->c);
- return free(s);
+ free(s);
}
void str_push(str* s, const char* insert){
diff --git a/src/util.c b/src/util.c
index bcaff02..39f2569 100644
--- a/src/util.c
+++ b/src/util.c
@@ -13,8 +13,10 @@ int gen_parse(char* inp, int len, parray_t** _table){
for(int i = 0; i < len; i++){
if(state != 1 && inp[i] == ';'){
- parray_set(table, last->c, (void*)current);
- str_free(last);
+ if(last != NULL){
+ parray_set(table, last->c, (void*)current);
+ str_free(last);
+ }
last = NULL;
current = str_init("");
state = 0;
@@ -67,3 +69,4 @@ void _p_fatal(const char* m, int line, const char* file, const char* function){
void p_error(const char* m){
fprintf(stderr, "%s[error]%s %s\n",color_red, color_reset, m);
}
+