Browse Source

convert to zalloc

tags/v0.9.3
Holger Lubitz 17 years ago
parent
commit
75ff85441b
1 changed files with 3 additions and 6 deletions
  1. 3
    6
      src/core/resolv.c

+ 3
- 6
src/core/resolv.c View File

116
 	struct sockaddr_in *sin;
116
 	struct sockaddr_in *sin;
117
 
117
 
118
 	/* Allocate and initialise structure */
118
 	/* Allocate and initialise structure */
119
-	numeric = malloc ( sizeof ( *numeric ) );
119
+	numeric = zalloc ( sizeof ( *numeric ) );
120
 	if ( ! numeric )
120
 	if ( ! numeric )
121
 		return -ENOMEM;
121
 		return -ENOMEM;
122
-	memset ( numeric, 0, sizeof ( *numeric ) );
123
 	resolv_init ( &numeric->resolv, &null_resolv_ops, &numeric->refcnt );
122
 	resolv_init ( &numeric->resolv, &null_resolv_ops, &numeric->refcnt );
124
 	process_init ( &numeric->process, numeric_step, &numeric->refcnt );
123
 	process_init ( &numeric->process, numeric_step, &numeric->refcnt );
125
 	memcpy ( &numeric->sa, sa, sizeof ( numeric->sa ) );
124
 	memcpy ( &numeric->sa, sa, sizeof ( numeric->sa ) );
258
 	int rc;
257
 	int rc;
259
 
258
 
260
 	/* Allocate and initialise structure */
259
 	/* Allocate and initialise structure */
261
-	mux = malloc ( sizeof ( *mux ) + name_len );
260
+	mux = zalloc ( sizeof ( *mux ) + name_len );
262
 	if ( ! mux )
261
 	if ( ! mux )
263
 		return -ENOMEM;
262
 		return -ENOMEM;
264
-	memset ( mux, 0, sizeof ( *mux ) );
265
 	resolv_init ( &mux->parent, &null_resolv_ops, &mux->refcnt );
263
 	resolv_init ( &mux->parent, &null_resolv_ops, &mux->refcnt );
266
 	resolv_init ( &mux->child, &resolv_mux_child_ops, &mux->refcnt );
264
 	resolv_init ( &mux->child, &resolv_mux_child_ops, &mux->refcnt );
267
 	mux->resolver = resolvers;
265
 	mux->resolver = resolvers;
388
 	int rc;
386
 	int rc;
389
 
387
 
390
 	/* Allocate and initialise structure */
388
 	/* Allocate and initialise structure */
391
-	named = malloc ( sizeof ( *named ) );
389
+	named = zalloc ( sizeof ( *named ) );
392
 	if ( ! named )
390
 	if ( ! named )
393
 		return -ENOMEM;
391
 		return -ENOMEM;
394
-	memset ( named, 0, sizeof ( *named ) );
395
 	xfer_init ( &named->xfer, &named_xfer_ops, &named->refcnt );
392
 	xfer_init ( &named->xfer, &named_xfer_ops, &named->refcnt );
396
 	resolv_init ( &named->resolv, &named_resolv_ops, &named->refcnt );
393
 	resolv_init ( &named->resolv, &named_resolv_ops, &named->refcnt );
397
 	named->semantics = semantics;
394
 	named->semantics = semantics;

Loading…
Cancel
Save