projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Replace mh_xmalloc() with mh_xcalloc()
[mmh]
/
sbr
/
fmt_new.c
diff --git
a/sbr/fmt_new.c
b/sbr/fmt_new.c
index
9a7988e
..
c3b1ea2
100644
(file)
--- a/
sbr/fmt_new.c
+++ b/
sbr/fmt_new.c
@@
-43,7
+43,7
@@
new_fs(char *form, char *def_form)
if (fstat(fileno(fp), &st) == -1) {
adios(EX_IOERR, form, "unable to stat format file");
}
if (fstat(fileno(fp), &st) == -1) {
adios(EX_IOERR, form, "unable to stat format file");
}
- formats = mh_xmalloc((size_t) st.st_size + 1);
+ formats = mh_xcalloc((size_t) st.st_size + 1, sizeof(char));
if (read(fileno(fp), formats, (int)st.st_size) != st.st_size) {
adios(EX_IOERR, form, "error reading format file");
}
if (read(fileno(fp), formats, (int)st.st_size) != st.st_size) {
adios(EX_IOERR, form, "error reading format file");
}
@@
-60,7
+60,7
@@
new_fs(char *form, char *def_form)
if (fstat(fileno(fp), &st) == -1) {
adios(EX_IOERR, def_form, "unable to stat format file");
}
if (fstat(fileno(fp), &st) == -1) {
adios(EX_IOERR, def_form, "unable to stat format file");
}
- formats = mh_xmalloc((size_t) st.st_size + 1);
+ formats = mh_xcalloc((size_t) st.st_size + 1, sizeof(char));
if (read(fileno(fp), formats, (int)st.st_size) != st.st_size) {
adios(EX_IOERR, def_form, "error reading format file");
}
if (read(fileno(fp), formats, (int)st.st_size) != st.st_size) {
adios(EX_IOERR, def_form, "error reading format file");
}