Fixed some malloc -> g_malloc, free -> g_free, strdup -> g_strdup.

svn path=/trunk/; revision=24179
This commit is contained in:
Stig Bjørlykke 2008-01-24 19:09:30 +00:00
parent 51060a1b5c
commit 11a9f57c1a
5 changed files with 14 additions and 14 deletions

View File

@ -618,7 +618,7 @@ int main(int argc, char *argv[])
out_frame_type = wtap_file_encap(wth);
if (split_packet_count > 0) {
filename = (char *) malloc(strlen(argv[optind+1]) + 20);
filename = (char *) g_malloc(strlen(argv[optind+1]) + 20);
if (!filename) {
exit(5);
}

6
file.c
View File

@ -1138,7 +1138,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
/* open the input files */
if (!merge_open_in_files(in_file_count, in_filenames, &in_files,
&open_err, &err_info, &err_fileno)) {
free(in_files);
g_free(in_files);
cf_open_failure_alert_box(in_filenames[err_fileno], open_err, err_info,
FALSE, 0);
return CF_ERROR;
@ -1159,7 +1159,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
if (out_fd == -1) {
err_info = NULL;
merge_close_in_files(in_file_count, in_files);
free(in_files);
g_free(in_files);
cf_open_failure_alert_box(out_filename, open_err, NULL, TRUE, file_type);
return CF_ERROR;
}
@ -1171,7 +1171,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
if (pdh == NULL) {
eth_close(out_fd);
merge_close_in_files(in_file_count, in_files);
free(in_files);
g_free(in_files);
cf_open_failure_alert_box(out_filename, open_err, err_info, TRUE,
file_type);
return CF_ERROR;

View File

@ -325,7 +325,7 @@ main(int argc, char *argv[])
pdh = wtap_dump_fdopen(out_fd, file_type, frame_type, snaplen, FALSE /* compressed */, &open_err);
if (pdh == NULL) {
merge_close_in_files(in_file_count, in_files);
free(in_files);
g_free(in_files);
fprintf(stderr, "mergecap: Can't open or create %s: %s\n", out_filename,
wtap_strerror(open_err));
exit(1);
@ -398,7 +398,7 @@ main(int argc, char *argv[])
wtap_strerror(write_err));
}
free(in_files);
g_free(in_files);
return (!got_read_error && !got_write_error) ? 0 : 2;
}

10
mkcap.c
View File

@ -535,7 +535,7 @@ process_drop_list(char *drop_list)
fprintf(stderr, "Strange drop list. NULL or an empty string. No drops!\n");
return;
}
save = (char *)strdup(drop_list);
save = (char *)g_strdup(drop_list);
for (tok=(char *)strtok(drop_list, ","); tok; tok=(char *)strtok(NULL, ",")) {
commas++;
@ -544,11 +544,11 @@ process_drop_list(char *drop_list)
/* Now, we have commas, divide by two and round up */
seg_drop_count = (commas+1)/2;
drops = (seg_drop_t *)malloc(sizeof(seg_drop_t) * seg_drop_count);
drops = (seg_drop_t *)g_malloc(sizeof(seg_drop_t) * seg_drop_count);
if (!drops) {
fprintf(stderr, "Unable to allocate space for drops ... going without!\n");
seg_drop_count = 0;
free(save);
g_free(save);
return;
}
@ -563,8 +563,8 @@ process_drop_list(char *drop_list)
fprintf(stderr, "Error in segment offset or count. Not all digits: %s\n",
tok);
fprintf(stderr, "No packet drops being performed!\n");
free(save);
free(drops);
g_free(save);
g_free(drops);
seg_drop_count = 0; drops = NULL;
return;
}

View File

@ -504,7 +504,7 @@ register_io_tap(io_stat_t *io, int i, const char *filter)
calc_type_table[j].func_name);
exit(10);
}
field=malloc(parenp-p+1);
field=g_malloc(parenp-p+1);
if(!field){
fprintf(stderr, "tshark: Out of memory.\n");
exit(10);
@ -517,7 +517,7 @@ register_io_tap(io_stat_t *io, int i, const char *filter)
if(!hfi){
fprintf(stderr, "tshark: There is no field named '%s'.\n",
field);
free(field);
g_free(field);
exit(10);
}
@ -583,7 +583,7 @@ register_io_tap(io_stat_t *io, int i, const char *filter)
}
break;
}
free(field);
g_free(field);
}
/*