Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
db8b419b
Commit
db8b419b
authored
Sep 04, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
archive/iso9660: free iso9660_stat_t as early as possible
parent
990f631c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
Iso9660ArchivePlugin.cxx
src/archive/plugins/Iso9660ArchivePlugin.cxx
+13
-11
No files found.
src/archive/plugins/Iso9660ArchivePlugin.cxx
View file @
db8b419b
...
...
@@ -142,23 +142,21 @@ Iso9660ArchiveFile::Visit(ArchiveVisitor &visitor)
class
Iso9660InputStream
final
:
public
InputStream
{
std
::
shared_ptr
<
Iso9660
>
iso
;
iso9660_stat_t
*
statbuf
;
const
lsn_t
lsn
;
public
:
Iso9660InputStream
(
const
std
::
shared_ptr
<
Iso9660
>
&
_iso
,
const
char
*
_uri
,
Mutex
&
_mutex
,
iso9660_stat_t
*
_statbuf
)
lsn_t
_lsn
,
offset_type
_size
)
:
InputStream
(
_uri
,
_mutex
),
iso
(
_iso
),
statbuf
(
_statbuf
)
{
size
=
statbuf
->
size
;
iso
(
_iso
),
lsn
(
_lsn
)
{
size
=
_size
;
SetReady
();
}
~
Iso9660InputStream
()
{
free
(
statbuf
);
}
/* virtual methods from InputStream */
bool
IsEOF
()
noexcept
override
;
size_t
Read
(
void
*
ptr
,
size_t
size
)
override
;
...
...
@@ -173,8 +171,12 @@ Iso9660ArchiveFile::OpenStream(const char *pathname,
throw
FormatRuntimeError
(
"not found in the ISO file: %s"
,
pathname
);
const
lsn_t
lsn
=
statbuf
->
lsn
;
const
offset_type
size
=
statbuf
->
size
;
free
(
statbuf
);
return
std
::
make_unique
<
Iso9660InputStream
>
(
iso
,
pathname
,
mutex
,
statbuf
);
lsn
,
size
);
}
size_t
...
...
@@ -184,7 +186,7 @@ Iso9660InputStream::Read(void *ptr, size_t read_size)
int
readed
=
0
;
int
no_blocks
,
cur_block
;
size_t
left_bytes
=
s
tatbuf
->
s
ize
-
offset
;
size_t
left_bytes
=
size
-
offset
;
if
(
left_bytes
<
read_size
)
{
no_blocks
=
CEILING
(
left_bytes
,
ISO_BLOCKSIZE
);
...
...
@@ -197,7 +199,7 @@ Iso9660InputStream::Read(void *ptr, size_t read_size)
cur_block
=
offset
/
ISO_BLOCKSIZE
;
readed
=
iso
->
SeekRead
(
ptr
,
statbuf
->
lsn
+
cur_block
,
no_blocks
);
readed
=
iso
->
SeekRead
(
ptr
,
lsn
+
cur_block
,
no_blocks
);
if
(
readed
!=
no_blocks
*
ISO_BLOCKSIZE
)
throw
FormatRuntimeError
(
"error reading ISO file at lsn %lu"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment