calling fwrite() with a null pointer causes undefined behavior. avoid it.

This commit is contained in:
Axel Kohlmeyer
2021-09-25 10:18:55 -04:00
parent 530912a930
commit 53e773e438
5 changed files with 10 additions and 5 deletions

View File

@ -562,6 +562,7 @@ void DumpAtom::write_binary(int n, double *mybuf)
void DumpAtom::write_string(int n, double *mybuf)
{
if (mybuf)
fwrite(mybuf,sizeof(char),n,fp);
}

View File

@ -233,6 +233,7 @@ void DumpCFG::write_data(int n, double *mybuf)
void DumpCFG::write_string(int n, double *mybuf)
{
if (mybuf)
fwrite(mybuf,sizeof(char),n,fp);
}

View File

@ -1234,6 +1234,7 @@ void DumpCustom::write_binary(int n, double *mybuf)
void DumpCustom::write_string(int n, double *mybuf)
{
if (mybuf)
fwrite(mybuf,sizeof(char),n,fp);
}

View File

@ -399,6 +399,7 @@ void DumpLocal::write_data(int n, double *mybuf)
void DumpLocal::write_string(int n, double *mybuf)
{
if (mybuf)
fwrite(mybuf,sizeof(char),n,fp);
}

View File

@ -194,6 +194,7 @@ void DumpXYZ::write_data(int n, double *mybuf)
void DumpXYZ::write_string(int n, double *mybuf)
{
if (mybuf)
fwrite(mybuf,sizeof(char),n,fp);
}