fix segfault when invoked with -h
This commit is contained in:
parent
c1e9ba2031
commit
ac22069e2b
4
mm/mm.c
4
mm/mm.c
@ -7,6 +7,7 @@
|
|||||||
#if !defined EX_OK || !defined EX_USAGE
|
#if !defined EX_OK || !defined EX_USAGE
|
||||||
# include <sysexits.h>
|
# include <sysexits.h>
|
||||||
#endif
|
#endif
|
||||||
|
extern int errno;
|
||||||
|
|
||||||
struct Io_ex{
|
struct Io_ex{
|
||||||
size_t s;
|
size_t s;
|
||||||
@ -49,6 +50,9 @@ static struct Io *
|
|||||||
Io_destruct(struct Io *io){
|
Io_destruct(struct Io *io){
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
if(io->s == -1)
|
||||||
|
io->s = 0;
|
||||||
|
|
||||||
for(i = 0; i < io->s; ++i)
|
for(i = 0; i < io->s; ++i)
|
||||||
fclose(io->files[i]);
|
fclose(io->files[i]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user