[Privoxy-commits] [privoxy] 04/07: make_path: Use malloc_or_die()
User Git
git at git.privoxy.org
Sun Oct 2 09:48:25 CEST 2022
This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository privoxy.
commit f87573e378e440c0f0aba367e04928f7da8aafae
Author: Fabian Keil <fk at fabiankeil.de>
AuthorDate: Wed Sep 28 08:06:14 2022 +0200
make_path: Use malloc_or_die()
... in cases where allocation errors were already fatal anyway.
---
miscutil.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/miscutil.c b/miscutil.c
index fe0cd9b5..e6532049 100644
--- a/miscutil.c
+++ b/miscutil.c
@@ -700,8 +700,7 @@ char * make_path(const char * dir, const char * file)
* Relative path, so start with the base directory.
*/
path_size += strlen(basedir) + 1; /* +1 for the slash */
- path = malloc(path_size);
- if (!path) log_error(LOG_LEVEL_FATAL, "malloc failed!");
+ path = malloc_or_die(path_size);
strlcpy(path, basedir, path_size);
strlcat(path, "/", path_size);
strlcat(path, dir, path_size);
@@ -709,8 +708,7 @@ char * make_path(const char * dir, const char * file)
else
#endif /* defined unix */
{
- path = malloc(path_size);
- if (!path) log_error(LOG_LEVEL_FATAL, "malloc failed!");
+ path = malloc_or_die(path_size);
strlcpy(path, dir, path_size);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Privoxy-commits
mailing list