Browse Source

convert to zalloc

tags/v0.9.3
Holger Lubitz 17 years ago
parent
commit
6def8592ed
1 changed files with 1 additions and 2 deletions
  1. 1
    2
      src/core/uri.c

+ 1
- 2
src/core/uri.c View File

77
 
77
 
78
 	/* Allocate space for URI struct and a copy of the string */
78
 	/* Allocate space for URI struct and a copy of the string */
79
 	raw_len = ( strlen ( uri_string ) + 1 /* NUL */ );
79
 	raw_len = ( strlen ( uri_string ) + 1 /* NUL */ );
80
-	uri = malloc ( sizeof ( *uri ) + raw_len );
80
+	uri = zalloc ( sizeof ( *uri ) + raw_len );
81
 	if ( ! uri )
81
 	if ( ! uri )
82
 		return NULL;
82
 		return NULL;
83
 	raw = ( ( ( char * ) uri ) + sizeof ( *uri ) );
83
 	raw = ( ( ( char * ) uri ) + sizeof ( *uri ) );
84
 
84
 
85
 	/* Zero URI struct and copy in the raw string */
85
 	/* Zero URI struct and copy in the raw string */
86
-	memset ( uri, 0, sizeof ( *uri ) );
87
 	memcpy ( raw, uri_string, raw_len );
86
 	memcpy ( raw, uri_string, raw_len );
88
 
87
 
89
 	/* Start by chopping off the fragment, if it exists */
88
 	/* Start by chopping off the fragment, if it exists */

Loading…
Cancel
Save