mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
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
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=317742
|
@ -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 a new issue