diff mbox series

[nft,5/5] datatype: use xmalloc() for allocating datatype in datatype_clone()

Message ID 20230927200143.3798124-6-thaller@redhat.com
State Accepted
Delegated to: Pablo Neira
Headers show
Series more various cleanups related to struct datatype | expand

Commit Message

Thomas Haller Sept. 27, 2023, 7:57 p.m. UTC
The returned memory will be initialized. No need to zero it first. Use
xmalloc() instead of xzalloc().

Signed-off-by: Thomas Haller <thaller@redhat.com>
---
 src/datatype.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Pablo Neira Ayuso Sept. 28, 2023, 7:11 p.m. UTC | #1
On Wed, Sep 27, 2023 at 09:57:28PM +0200, Thomas Haller wrote:
> The returned memory will be initialized. No need to zero it first. Use
> xmalloc() instead of xzalloc().

Applied this little patch, thanks
diff mbox series

Patch

diff --git a/src/datatype.c b/src/datatype.c
index f9570603467a..eae7f4c71fbe 100644
--- a/src/datatype.c
+++ b/src/datatype.c
@@ -1242,7 +1242,7 @@  struct datatype *datatype_clone(const struct datatype *orig_dtype)
 {
 	struct datatype *dtype;
 
-	dtype = xzalloc(sizeof(*dtype));
+	dtype = xmalloc(sizeof(*dtype));
 	*dtype = *orig_dtype;
 	if (orig_dtype->f_allocated_strings) {
 		dtype->name = xstrdup(orig_dtype->name);