Mercurial > gftp.yaz
comparison lib/config_file.c @ 942:85cf59eafce2
2008-01-24 Brian Masney <masneyb@gftp.org>
* lib/config_file.c lib/sshv2.c lib/sslcommon.c lib/rfc2068.c -
s/g_malloc/g_malloc0/
author | masneyb |
---|---|
date | Thu, 24 Jan 2008 23:28:30 +0000 |
parents | 1808cebed602 |
children | 63555c9744c2 |
comparison
equal
deleted
inserted
replaced
941:19b6d55e2646 | 942:85cf59eafce2 |
---|---|
361 } | 361 } |
362 } | 362 } |
363 else | 363 else |
364 endpos = curpos + strlen (curpos); | 364 endpos = curpos + strlen (curpos); |
365 | 365 |
366 *dest = g_malloc ((gulong) (endpos - curpos + 1)); | 366 *dest = g_malloc0 ((gulong) (endpos - curpos + 1)); |
367 tempchar = *endpos; | 367 tempchar = *endpos; |
368 *endpos = '\0'; | 368 *endpos = '\0'; |
369 strcpy (*dest, curpos); | 369 strcpy (*dest, curpos); |
370 *endpos = tempchar; | 370 *endpos = tempchar; |
371 if (has_colon) | 371 if (has_colon) |
393 } | 393 } |
394 | 394 |
395 while (numargs > 1) | 395 while (numargs > 1) |
396 { | 396 { |
397 dest = va_arg (argp, char **); | 397 dest = va_arg (argp, char **); |
398 *dest = g_malloc (1); | 398 *dest = g_malloc0 (1); |
399 **dest = '\0'; | |
400 numargs--; | 399 numargs--; |
401 } | 400 } |
402 va_end (argp); | 401 va_end (argp); |
403 return (ret); | 402 return (ret); |
404 } | 403 } |
475 static void * | 474 static void * |
476 gftp_config_read_ext (char *buf, int line) | 475 gftp_config_read_ext (char *buf, int line) |
477 { | 476 { |
478 gftp_file_extensions * tempext; | 477 gftp_file_extensions * tempext; |
479 | 478 |
480 tempext = g_malloc (sizeof (*tempext)); | 479 tempext = g_malloc0 (sizeof (*tempext)); |
481 gftp_config_parse_args (buf, 4, line, &tempext->ext, &tempext->filename, | 480 gftp_config_parse_args (buf, 4, line, &tempext->ext, &tempext->filename, |
482 &tempext->ascii_binary, &tempext->view_program); | 481 &tempext->ascii_binary, &tempext->view_program); |
483 | 482 |
484 tempext->stlen = strlen (tempext->ext); | 483 tempext->stlen = strlen (tempext->ext); |
485 | 484 |
1119 if (cv->flags & GFTP_CVARS_FLAGS_DYNMEM && cv->value != NULL) | 1118 if (cv->flags & GFTP_CVARS_FLAGS_DYNMEM && cv->value != NULL) |
1120 g_free (cv->value); | 1119 g_free (cv->value); |
1121 | 1120 |
1122 gftp_config_parse_args (str, 3, line, &red, &green, &blue); | 1121 gftp_config_parse_args (str, 3, line, &red, &green, &blue); |
1123 | 1122 |
1124 color = g_malloc (sizeof (*color)); | 1123 color = g_malloc0 (sizeof (*color)); |
1125 color->red = strtol (red, NULL, 16); | 1124 color->red = strtol (red, NULL, 16); |
1126 color->green = strtol (green, NULL, 16); | 1125 color->green = strtol (green, NULL, 16); |
1127 color->blue = strtol (blue, NULL, 16); | 1126 color->blue = strtol (blue, NULL, 16); |
1128 g_free (red); | 1127 g_free (red); |
1129 g_free (green); | 1128 g_free (green); |
1152 gftp_config_file_copy_color (gftp_config_vars * cv, gftp_config_vars * dest_cv) | 1151 gftp_config_file_copy_color (gftp_config_vars * cv, gftp_config_vars * dest_cv) |
1153 { | 1152 { |
1154 if (dest_cv->flags & GFTP_CVARS_FLAGS_DYNMEM && dest_cv->value != NULL) | 1153 if (dest_cv->flags & GFTP_CVARS_FLAGS_DYNMEM && dest_cv->value != NULL) |
1155 g_free (dest_cv->value); | 1154 g_free (dest_cv->value); |
1156 | 1155 |
1157 dest_cv->value = g_malloc (sizeof (gftp_color)); | 1156 dest_cv->value = g_malloc0 (sizeof (gftp_color)); |
1158 memcpy (dest_cv->value, cv->value, sizeof (gftp_color)); | 1157 memcpy (dest_cv->value, cv->value, sizeof (gftp_color)); |
1159 dest_cv->flags |= GFTP_CVARS_FLAGS_DYNMEM; | 1158 dest_cv->flags |= GFTP_CVARS_FLAGS_DYNMEM; |
1160 } | 1159 } |
1161 | 1160 |
1162 | 1161 |
1481 } | 1480 } |
1482 | 1481 |
1483 *new_options_hash = g_hash_table_new (string_hash_function, | 1482 *new_options_hash = g_hash_table_new (string_hash_function, |
1484 string_hash_compare); | 1483 string_hash_compare); |
1485 | 1484 |
1486 *new_options_vars = g_malloc ((gulong) sizeof (gftp_config_vars) * num_local_options_vars); | 1485 *new_options_vars = g_malloc0 ((gulong) sizeof (gftp_config_vars) * num_local_options_vars); |
1487 memcpy (*new_options_vars, orig_options, | 1486 memcpy (*new_options_vars, orig_options, |
1488 sizeof (gftp_config_vars) * num_local_options_vars); | 1487 sizeof (gftp_config_vars) * num_local_options_vars); |
1489 | 1488 |
1490 for (i=0; i<num_local_options_vars; i++) | 1489 for (i=0; i<num_local_options_vars; i++) |
1491 { | 1490 { |