Fix memory leaks
This commit is contained in:
parent
9bc7d51074
commit
12331d66f5
7 changed files with 24 additions and 14 deletions
|
|
@ -89,6 +89,8 @@ static vector<string> list_directory(string dir_name) {
|
|||
if (name != "." && name != "..")
|
||||
result.push_back(dir_name + "/" + name);
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,11 +21,6 @@ static int spy_seek(void *data, size_t position) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void spy_release(void *data) {
|
||||
SpyReader *reader = static_cast<SpyReader *>(data);
|
||||
delete reader;
|
||||
}
|
||||
|
||||
SpyReader::SpyReader(string content, size_t chunk_size) :
|
||||
content(content),
|
||||
position(0),
|
||||
|
|
@ -34,5 +29,5 @@ SpyReader::SpyReader(string content, size_t chunk_size) :
|
|||
this,
|
||||
spy_read,
|
||||
spy_seek,
|
||||
spy_release,
|
||||
nullptr,
|
||||
}) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue