mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-29 23:52:22 +00:00
use calloc instead of malloc when creating objects. clears up some
uninitialized memory usages pointed out by valgrind.
This commit is contained in:
parent
1e20043bf3
commit
45f542d293
1 changed files with 3 additions and 3 deletions
|
@ -117,7 +117,7 @@ Class_Deinit_f (Object *self) {
|
|||
Object *
|
||||
Object_Create (Class *cl, qboolean floating)
|
||||
{
|
||||
Object *new = malloc (cl->size);
|
||||
Object *new = calloc (1, cl->size);
|
||||
new->cl = cl;
|
||||
if (floating) {
|
||||
new->refs = 0;
|
||||
|
@ -211,8 +211,8 @@ Object_Init (void)
|
|||
/* There is somewhat of a chicken and egg problem
|
||||
here.
|
||||
*/
|
||||
Object_class = malloc (sizeof (struct Class_s));
|
||||
Class_class = malloc (sizeof (struct Class_s));
|
||||
Object_class = calloc (1, sizeof (struct Class_s));
|
||||
Class_class = calloc (1, sizeof (struct Class_s));
|
||||
OBJECT(Object_class)->cl = Class_class;
|
||||
OBJECT(Class_class)->cl = Class_class;
|
||||
Class_class->parent = Object_class;
|
||||
|
|
Loading…
Reference in a new issue