Commit 9284ed3
Don't call
A GVariant may require 0 bytes to serialize. In which case, `data_size`
will be 0 and we'll call `g_malloc0 (0)` which returns `NULL`.
The `data` argument of `g_variant_store` is declared as non-nullable,
so we shouldn't pass it `NULL`. In older glib versions, this wasn't
explicitly checked and it still transparently worked for our case
because there was nothing to actually serialize. Starting from v2.84.1,
a precondition was added:
https://gitlab.gnome.org/GNOME/glib/-/commit/39c05b13123b12622ee2c93c170dbf20b573f6ac
Let's respect the API here and stop calling the function if it's not
needed.
Note that `g_variant_new_from_data()` supports being passed `NULL` and 0
for the data and size arguments.g_variant_store() with NULL
1 parent c6ffc06 commit 9284ed3
1 file changed
+6
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
366 | | - | |
| 366 | + | |
367 | 367 | | |
368 | | - | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
369 | 373 | | |
370 | 374 | | |
371 | 375 | | |
| |||
0 commit comments