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) {
|
if (rv == 0) {
|
||||||
/* EOF? */
|
/* EOF? */
|
||||||
warnx("premature EOF after %u bytes", nbytes);
|
warnx("premature EOF after %u bytes", nbytes);
|
||||||
|
free(trackbuf);
|
||||||
return (EX_OK);
|
return (EX_OK);
|
||||||
}
|
}
|
||||||
if ((unsigned)rv == tracksize) {
|
if ((unsigned)rv == tracksize) {
|
||||||
@ -215,6 +216,7 @@ doread(int fd, FILE *of, const char *_devname)
|
|||||||
if (!quiet)
|
if (!quiet)
|
||||||
putc('\n', stderr);
|
putc('\n', stderr);
|
||||||
perror("non-IO error");
|
perror("non-IO error");
|
||||||
|
free(trackbuf);
|
||||||
return (EX_OSERR);
|
return (EX_OSERR);
|
||||||
}
|
}
|
||||||
if (ioctl(fd, FD_GSTAT, &fdcs) == -1)
|
if (ioctl(fd, FD_GSTAT, &fdcs) == -1)
|
||||||
@ -233,6 +235,7 @@ doread(int fd, FILE *of, const char *_devname)
|
|||||||
if (!recover) {
|
if (!recover) {
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
putc('\n', stderr);
|
putc('\n', stderr);
|
||||||
|
free(trackbuf);
|
||||||
return (EX_IOERR);
|
return (EX_IOERR);
|
||||||
}
|
}
|
||||||
memset(trackbuf, fillbyte, secsize);
|
memset(trackbuf, fillbyte, secsize);
|
||||||
@ -284,6 +287,7 @@ doread(int fd, FILE *of, const char *_devname)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
free(trackbuf);
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
putc('\n', stderr);
|
putc('\n', stderr);
|
||||||
if (nerrs)
|
if (nerrs)
|
||||||
|
Loading…
Reference in New Issue
Block a user