Compiler warnings

This commit is contained in:
Shahram Najm 2017-10-27 11:20:09 +01:00
parent 5e37b34a7a
commit 26aaa2f68b
1 changed files with 4 additions and 2 deletions

View File

@ -41,6 +41,7 @@ static int split_file(FILE* in, const char* filename, int nchunks,unsigned long
out=fopen(ofilename,"w"); out=fopen(ofilename,"w");
if (!out) { if (!out) {
perror(ofilename); perror(ofilename);
free(ofilename);
return GRIB_IO_PROBLEM; return GRIB_IO_PROBLEM;
} }
@ -49,8 +50,8 @@ static int split_file(FILE* in, const char* filename, int nchunks,unsigned long
if (mesg!=NULL && err==0) { if (mesg!=NULL && err==0) {
if (fwrite(mesg,1,size,out)!=size) { if (fwrite(mesg,1,size,out)!=size) {
perror(ofilename); perror(ofilename);
free(ofilename);
fclose(out); fclose(out);
fclose(in);
return GRIB_IO_PROBLEM; return GRIB_IO_PROBLEM;
} }
grib_context_free(c,mesg); grib_context_free(c,mesg);
@ -62,6 +63,7 @@ static int split_file(FILE* in, const char* filename, int nchunks,unsigned long
out=fopen(ofilename,"w"); out=fopen(ofilename,"w");
if (!out) { if (!out) {
perror(ofilename); perror(ofilename);
free(ofilename);
return GRIB_IO_PROBLEM; return GRIB_IO_PROBLEM;
} }
read_size=0; read_size=0;
@ -70,6 +72,7 @@ static int split_file(FILE* in, const char* filename, int nchunks,unsigned long
} }
} }
fclose(out); fclose(out);
free(ofilename);
if (err==GRIB_END_OF_FILE) err=GRIB_SUCCESS; if (err==GRIB_END_OF_FILE) err=GRIB_SUCCESS;
@ -83,7 +86,6 @@ int main(int argc,char* argv[])
int i, verbose=0; int i, verbose=0;
int err=0,nchunks=0; int err=0,nchunks=0;
unsigned long count=0; unsigned long count=0;
int message_type = 0; /* GRIB, BUFR etc */
if (argc <3) usage(argv[0]); if (argc <3) usage(argv[0]);