[PATCH] object: Initialize allocated memory to zero.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If object subclasses have errors with uninitialized
variables, those are easier to detect and debug when the
memory is always zero. It also makes it possible to
intentionally omit manual variable initialization to zero,
which may be sometimes desirable.
---
 src/pulsecore/object.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pulsecore/object.c b/src/pulsecore/object.c
index 0dc8198..b6fbe90 100644
--- a/src/pulsecore/object.c
+++ b/src/pulsecore/object.c
@@ -40,7 +40,7 @@ pa_object *pa_object_new_internal(size_t size, const char *type_id, pa_bool_t (*
     pa_assert(check_type(type_id));
     pa_assert(check_type(pa_object_type_id));
 
-    o = pa_xmalloc(size);
+    o = pa_xmalloc0(size);
     PA_REFCNT_INIT(o);
     o->type_id = type_id;
     o->free = pa_object_free;
-- 
1.7.10



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux