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); g_free((void*)content_type);
content_type = NULL; content_type = NULL;
content = g_try_realloc(content, length + BUFSIZ); guchar* temp_content = g_try_realloc(content, length + BUFSIZ);
if (content == NULL) { if (temp_content == NULL) {
continue; break;
} }
content = temp_content;
bytes_read = read(fd, content + length, BUFSIZ); bytes_read = read(fd, content + length, BUFSIZ);
if (bytes_read == -1) { if (bytes_read == -1) {