diff mbox series

[ulogd2,12/34] conffile: replace malloc+strcpy with strdup

Message ID 20221121222611.3914559-13-jeremy@azazel.net
State Changes Requested
Delegated to: Pablo Neira
Headers show
Series Refactor of the DB output plug-ins | expand

Commit Message

Jeremy Sowden Nov. 21, 2022, 10:25 p.m. UTC
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
 src/conffile.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/src/conffile.c b/src/conffile.c
index 8a208d6d8cfe..e58f54778e41 100644
--- a/src/conffile.c
+++ b/src/conffile.c
@@ -104,12 +104,10 @@  int config_register_file(const char *file)
 
 	pr_debug("%s: registered config file '%s'\n", __func__, file);
 
-	fname = malloc(strlen(file)+1);
+	fname = strdup(file);
 	if (!fname)
 		return -ERROOM;
 
-	strcpy(fname, file);
-
 	return 0;
 }