summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2019-07-04 14:59:24 +0200
committerJakub Jelen <jjelen@redhat.com>2019-07-04 16:05:09 +0200
commit708fed0c074adafe78aca013c206ff66978d7c35 (patch)
tree3eb6a3a7d4dd8dc1541fd121cd52a559a76fbe51 /src
parent13bc693196e86b281d3c503b21f62d8dd338464a (diff)
cac: Use g_memdup for better readability and avoiding code duplication
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/cac.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/cac.c b/src/cac.c
index 52a0df1..d5594b0 100644
--- a/src/cac.c
+++ b/src/cac.c
@@ -1972,8 +1972,7 @@ cac_new_empty_applet_private(unsigned char objects[][2], unsigned int objects_le
/* Create Object ID list */
if (objects_len > 0) {
- applet_private->coids = g_malloc_n(objects_len, sizeof(struct coid));
- memcpy(applet_private->coids, objects, 2*objects_len);
+ applet_private->coids = g_memdup(objects, sizeof(struct coid) * objects_len);
applet_private->coids_len = objects_len;
}