This commit is contained in:
Xuan Sang LE 2018-03-02 21:28:04 +01:00
parent 6bc76386f6
commit 358090fb96

View File

@ -144,7 +144,7 @@ char* ext(const char* file)
if(file == NULL) return NULL; if(file == NULL) return NULL;
char* str_cpy = strdup(file); char* str_cpy = strdup(file);
char* str_org = str_cpy; char* str_org = str_cpy;
if(strstr(str_cpy,".")<= 0) return ""; if(strstr(str_cpy,".")<= 0) return strdup("");
if(*file == '.') if(*file == '.')
trim(str_cpy,'.'); trim(str_cpy,'.');
@ -184,6 +184,7 @@ char* mime(const char* file)
{ {
char * ex = ext(file); char * ex = ext(file);
mime_t m = mime_from_ext(ex); mime_t m = mime_from_ext(ex);
if(ex)
free(ex); free(ex);
return m.type; return m.type;
} }
@ -192,6 +193,7 @@ int is_bin(const char* file)
{ {
char * ex = ext(file); char * ex = ext(file);
mime_t m = mime_from_ext(ex); mime_t m = mime_from_ext(ex);
if(ex)
free(ex); free(ex);
return m.bin; return m.bin;
} }