From: David Levine Date: Thu, 25 Dec 2014 00:25:43 +0000 (-0600) Subject: Fixed memory leak in mime_type(). get_file_info() always allocates X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/1de60d4aa818748f6bc24e55556526f53c22cab2?ds=inline;hp=64f5cda4610fa3de39a9d69aeda2d8a26f147f2e Fixed memory leak in mime_type(). get_file_info() always allocates its return value. --- diff --git a/sbr/mime_type.c b/sbr/mime_type.c index 06a6156d..23ccf038 100644 --- a/sbr/mime_type.c +++ b/sbr/mime_type.c @@ -37,14 +37,15 @@ mime_type(const char *file_name) { if ((mimeencoding = get_file_info(MIMEENCODINGPROC, file_name))) { content_type = concat(mimetype, "; charset=", mimeencoding, NULL); + free (mimetype); } else { - content_type = strdup(mimetype); + content_type = mimetype; } } else { - content_type = strdup(mimetype); + content_type = mimetype; } #else /* MIMEENCODINGPROC */ - content_type = strdup(mimetype); + content_type = mimetype; #endif /* MIMEENCODINGPROC */ } #endif /* MIMETYPEPROC */