diff options
author | Omar Polo <op@omarpolo.com> | 2022-04-08 13:44:49 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2022-04-08 13:44:49 +0000 |
commit | d8d170aa5ee1498babee095078b3888f1525a2b3 (patch) | |
tree | 7b025561608a276e18b63bf6955bb34a2d948fac /gmid.h | |
parent | aa6b8cf8ac4d93444bc2b4076b98621968bfc6ab (diff) |
allow add_mime to fail
add_mime nows allocate dinamically copies of the passed strings, so
that we can actually free what we parse from the config file.
This matters a lot especially with lengthy `types' block: strings that
reach the internal mapping are never free'd, so every manual addition
is leaked.
Diffstat (limited to 'gmid.h')
-rw-r--r-- | gmid.h | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -176,8 +176,8 @@ struct vhost { }; struct etm { /* extension to mime */ - const char *mime; - const char *ext; + char *mime; + char *ext; }; struct mime { @@ -353,9 +353,10 @@ int logger_main(int, struct imsgbuf*); /* mime.c */ void init_mime(struct mime*); -void add_mime(struct mime*, const char*, const char*); -void load_default_mime(struct mime*); +int add_mime(struct mime*, const char*, const char*); +int load_default_mime(struct mime*); const char *mime(struct vhost*, const char*); +void free_mime(struct mime *); /* server.c */ extern int shutting_down; |