g_try_realloc behaves like realloc

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
Sebastian Ramacher 2014-01-19 19:39:58 +01:00
parent d83d7bc7d9
commit 7fc2b365ba

View File

@ -134,10 +134,11 @@ guess_type_glib(const char* path)
g_free((void*)content_type);
content_type = NULL;
content = g_try_realloc(content, length + BUFSIZ);
if (content == NULL) {
continue;
guchar* temp_content = g_try_realloc(content, length + BUFSIZ);
if (temp_content == NULL) {
break;
}
content = temp_content;
bytes_read = read(fd, content + length, BUFSIZ);
if (bytes_read == -1) {