mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-24 07:27:44 +01:00
Fix memory leak on error condition (#4798).
git-svn-id: svn://localhost/ardour2/branches/3.0@11775 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
c38cbac7e7
commit
5de4de613b
1 changed files with 3 additions and 2 deletions
|
|
@ -833,13 +833,14 @@ load_file_into_buffer(void **file_buffer, size_t *file_buffer_length, FILE* stre
|
||||||
*file_buffer = malloc(*file_buffer_length);
|
*file_buffer = malloc(*file_buffer_length);
|
||||||
if (*file_buffer == NULL) {
|
if (*file_buffer == NULL) {
|
||||||
g_critical("malloc(3) failed: %s", strerror(errno));
|
g_critical("malloc(3) failed: %s", strerror(errno));
|
||||||
|
|
||||||
return (-5);
|
return (-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fread(*file_buffer, 1, *file_buffer_length, stream) != *file_buffer_length) {
|
if (fread(*file_buffer, 1, *file_buffer_length, stream) != *file_buffer_length) {
|
||||||
g_critical("fread(3) failed: %s", strerror(errno));
|
g_critical("fread(3) failed: %s", strerror(errno));
|
||||||
|
free (*file_buffer);
|
||||||
|
*file_buffer = NULL;
|
||||||
return (-6);
|
return (-6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue