This diff is correct and the use-case makes sense to me.
OK florian

On 2022-09-01 21:30 +01, Ben Fuller <ben@bvnf.space> wrote:
> On Thu, Sep 01, 2022 at 21:22:13 +0100, Ben Fuller wrote:
>> On Thu, Sep 01, 2022 at 21:44:34 +0200, Florian Obser wrote:
>> > Pretty sure this doesn't compile.
>> > If it were to compile it would leak memory.
>> 
>> It did compile, but you're right. This version should free everything:
>
> Makes more sense to use the existing function (sorry for the spam):
>
> ---
>  usr.sbin/httpd/httpd.c      | 4 ++--
>  usr.sbin/httpd/httpd.conf.5 | 1 +
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git usr.sbin/httpd/httpd.c usr.sbin/httpd/httpd.c
> index 2acecd1732f..efe199c20a9 100644
> --- usr.sbin/httpd/httpd.c
> +++ usr.sbin/httpd/httpd.c
> @@ -1080,9 +1080,9 @@ media_add(struct mediatypes *types, struct media_type 
> *media)
>       struct media_type       *entry;
>  
>       if ((entry = RB_FIND(mediatypes, types, media)) != NULL) {
> -             log_debug("%s: duplicated entry for \"%s\"", __func__,
> +             log_debug("%s: entry overwritten for \"%s\"", __func__,
>                   media->media_name);
> -             return (NULL);
> +             media_delete(types, entry);
>       }
>  
>       if ((entry = malloc(sizeof(*media))) == NULL)
> diff --git usr.sbin/httpd/httpd.conf.5 usr.sbin/httpd/httpd.conf.5
> index b5f0be465a0..02f240091b0 100644
> --- usr.sbin/httpd/httpd.conf.5
> +++ usr.sbin/httpd/httpd.conf.5
> @@ -753,6 +753,7 @@ to the specified extension
>  .Ar name .
>  One or more names can be specified per line.
>  Each line may end with an optional semicolon.
> +Later lines overwrite earlier lines.
>  .It Ic include Ar file
>  Include types definitions from an external file, for example
>  .Pa /usr/share/misc/mime.types .
>

-- 
I'm not entirely sure you are real.

Reply via email to