aboutsummaryrefslogtreecommitdiff
path: root/net/queue.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2014-12-04 14:28:17 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2014-12-19 13:17:02 +0000
commit58889fe50a7c5b8776cf3096a8fe611fb66c4e5c (patch)
treec5cf3f17b67b4cfe5573942b02b78a7435d86dfe /net/queue.c
parent71e28e3cc24ff3b0268903758aae357592eb8b74 (diff)
net: Use g_new() & friends where that makes obvious sense
g_new(T, n) is neater than g_malloc(sizeof(T) * n). It's also safer, for two reasons. One, it catches multiplication overflowing size_t. Two, it returns T * rather than void *, which lets the compiler catch more type errors. This commit only touches allocations with size arguments of the form sizeof(T). Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'net/queue.c')
-rw-r--r--net/queue.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/queue.c b/net/queue.c
index f948318718..ebbe2bb93b 100644
--- a/net/queue.c
+++ b/net/queue.c
@@ -62,7 +62,7 @@ NetQueue *qemu_new_net_queue(void *opaque)
{
NetQueue *queue;
- queue = g_malloc0(sizeof(NetQueue));
+ queue = g_new0(NetQueue, 1);
queue->opaque = opaque;
queue->nq_maxlen = 10000;