Free the memory allocated to trackbuf before exiting, it might fix a potential
memory leak. Submitted by: trix@juniper.net MFC after: 2 weeks. Differential Revision: https://reviews.freebsd.org/D9856
This commit is contained in:
parent
83fd8885c4
commit
049e195404
@ -184,6 +184,7 @@ doread(int fd, FILE *of, const char *_devname)
|
||||
if (rv == 0) {
|
||||
/* EOF? */
|
||||
warnx("premature EOF after %u bytes", nbytes);
|
||||
free(trackbuf);
|
||||
return (EX_OK);
|
||||
}
|
||||
if ((unsigned)rv == tracksize) {
|
||||
@ -215,6 +216,7 @@ doread(int fd, FILE *of, const char *_devname)
|
||||
if (!quiet)
|
||||
putc('\n', stderr);
|
||||
perror("non-IO error");
|
||||
free(trackbuf);
|
||||
return (EX_OSERR);
|
||||
}
|
||||
if (ioctl(fd, FD_GSTAT, &fdcs) == -1)
|
||||
@ -233,6 +235,7 @@ doread(int fd, FILE *of, const char *_devname)
|
||||
if (!recover) {
|
||||
if (!quiet)
|
||||
putc('\n', stderr);
|
||||
free(trackbuf);
|
||||
return (EX_IOERR);
|
||||
}
|
||||
memset(trackbuf, fillbyte, secsize);
|
||||
@ -284,6 +287,7 @@ doread(int fd, FILE *of, const char *_devname)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
free(trackbuf);
|
||||
if (!quiet) {
|
||||
putc('\n', stderr);
|
||||
if (nerrs)
|
||||
|
Loading…
Reference in New Issue
Block a user