mirror of
https://github.com/flatpak/flatpak.git
synced 2026-10-06 12:59:38 -04:00
dir: Fix NULL dereference in replace_contents_compressed
g_file_replace can return NULL on failure (e.g. disk full). The result was passed to g_converter_output_stream_new before the NULL check. Move the check before use.
This commit is contained in:
1 parent
2ff1d3b0b3
commit
eb179c500c
1 file changed
+2
-1
@@ -5741,10 +5741,11 @@ replace_contents_compressed (GFile *dest,
|
||||
compressor = g_zlib_compressor_new (G_ZLIB_COMPRESSOR_FORMAT_GZIP, -1);
|
||||
out = g_file_replace (dest, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION,
|
||||
NULL, error);
|
||||
out2 = g_converter_output_stream_new (G_OUTPUT_STREAM (out), G_CONVERTER (compressor));
|
||||
if (out == NULL)
|
||||
return FALSE;
|
||||
|
||||
out2 = g_converter_output_stream_new (G_OUTPUT_STREAM (out), G_CONVERTER (compressor));
|
||||
|
||||
if (!g_output_stream_write_all (out2,
|
||||
g_bytes_get_data (contents, NULL),
|
||||
g_bytes_get_size (contents),
|
||||
|
||||
Reference in new issue
Block a user