Commit 7fc2b365 authored by Sebastian Ramacher's avatar Sebastian Ramacher

g_try_realloc behaves like realloc

Signed-off-by: Sebastian Ramacher's avatarSebastian Ramacher <sebastian+dev@ramacher.at>
parent d83d7bc7
...@@ -134,10 +134,11 @@ guess_type_glib(const char* path) ...@@ -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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment