diff options
author | Michael Tokarev <mjt@tls.msk.ru> | 2014-05-08 19:51:01 +0400 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2014-05-24 00:07:29 +0400 |
commit | 78a4b8d2051bff8e8794e9419b7925122212b096 (patch) | |
tree | 687653b7bb47b09b472676db67d50acea37e2cfb /libcacard/vreader.c | |
parent | 6054d883d6138bfc92c73a7c090c824b64086fd2 (diff) |
libcacard: g_malloc cleanups
This patch replaces g_malloc() in libcacard into g_new()
or g_new0() where appropriate (removing some init-to-zero
surrounding code), g_malloc+memcpy into g_memdup() and the
like.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Alon Levy <alevy@redhat.com>
Diffstat (limited to 'libcacard/vreader.c')
-rw-r--r-- | libcacard/vreader.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/libcacard/vreader.c b/libcacard/vreader.c index 77202951fb..9304a2824d 100644 --- a/libcacard/vreader.c +++ b/libcacard/vreader.c @@ -115,7 +115,7 @@ vreader_new(const char *name, VReaderEmul *private, { VReader *reader; - reader = (VReader *)g_malloc(sizeof(VReader)); + reader = g_new(VReader, 1); qemu_mutex_init(&reader->lock); reader->reference_count = 1; reader->name = g_strdup(name); @@ -312,10 +312,7 @@ vreader_list_entry_new(VReader *reader) { VReaderListEntry *new_reader_list_entry; - new_reader_list_entry = (VReaderListEntry *) - g_malloc(sizeof(VReaderListEntry)); - new_reader_list_entry->next = NULL; - new_reader_list_entry->prev = NULL; + new_reader_list_entry = g_new0(VReaderListEntry, 1); new_reader_list_entry->reader = vreader_reference(reader); return new_reader_list_entry; } @@ -336,9 +333,7 @@ vreader_list_new(void) { VReaderList *new_reader_list; - new_reader_list = (VReaderList *)g_malloc(sizeof(VReaderList)); - new_reader_list->head = NULL; - new_reader_list->tail = NULL; + new_reader_list = g_new0(VReaderList, 1); return new_reader_list; } |