mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-24 08:27:53 +00:00
Merge pull request #1533 from odin-lang/bug_report
[report] Fix `odin report` crash if `/usr/lib/os-release` doesn't exist.
This commit is contained in:
+2
-2
@@ -473,11 +473,11 @@ void print_bug_report_help() {
|
|||||||
|
|
||||||
#elif defined(GB_SYSTEM_LINUX)
|
#elif defined(GB_SYSTEM_LINUX)
|
||||||
/*
|
/*
|
||||||
Try to parse `/usr/lib/os-release` for `PRETTY_NAME="Ubuntu 20.04.3 LTS`
|
Try to parse `/etc/os-release` for `PRETTY_NAME="Ubuntu 20.04.3 LTS`
|
||||||
*/
|
*/
|
||||||
gbAllocator a = heap_allocator();
|
gbAllocator a = heap_allocator();
|
||||||
|
|
||||||
gbFileContents release = gb_file_read_contents(a, 1, "/usr/lib/os-release");
|
gbFileContents release = gb_file_read_contents(a, 1, "/etc/os-release");
|
||||||
defer (gb_file_free_contents(&release));
|
defer (gb_file_free_contents(&release));
|
||||||
|
|
||||||
b32 found = 0;
|
b32 found = 0;
|
||||||
|
|||||||
@@ -6093,6 +6093,7 @@ gbFileContents gb_file_read_contents(gbAllocator a, b32 zero_terminate, char con
|
|||||||
}
|
}
|
||||||
|
|
||||||
void gb_file_free_contents(gbFileContents *fc) {
|
void gb_file_free_contents(gbFileContents *fc) {
|
||||||
|
if (fc == NULL || fc->size == 0) return;
|
||||||
GB_ASSERT_NOT_NULL(fc->data);
|
GB_ASSERT_NOT_NULL(fc->data);
|
||||||
gb_free(fc->allocator, fc->data);
|
gb_free(fc->allocator, fc->data);
|
||||||
fc->data = NULL;
|
fc->data = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user