summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2018-08-23 12:54:20 +0100
committerJakub Jelen <jjelen@redhat.com>2019-11-18 09:39:57 +0100
commit2bae8772377597718852b37f6b84db005c01ec67 (patch)
treec1bb2b451d8dcef13b622b489b789d74c5215677 /src
parent6eb75750d0167810d88f2551ac0c56bad6a3bbdb (diff)
simpletlv: Reuse g_memdup
The effect of g_new+memcpy is the same of a single g_memdup Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jakub Jelen <jjelen@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/simpletlv.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/simpletlv.c b/src/simpletlv.c
index 0d7f72d..d6cb983 100644
--- a/src/simpletlv.c
+++ b/src/simpletlv.c
@@ -294,9 +294,7 @@ simpletlv_clone(struct simpletlv_member *tlv, size_t tlvlen)
if (new[i].value.child == NULL)
goto failure;
} else {
- new[i].value.value = g_new(unsigned char, tlv[i].length);
- memcpy(new[i].value.value, tlv[i].value.value,
- tlv[i].length);
+ new[i].value.value = g_memdup(tlv[i].value.value, tlv[i].length);
}
}
return new;