]> git.proxmox.com Git - pve-cluster.git/commitdiff
pmxcfs: workaround dumb g_string_free behaviour
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 24 Jun 2019 10:44:51 +0000 (12:44 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 24 Jun 2019 10:44:54 +0000 (12:44 +0200)
While GLib mentions that this method is nullable[0][1] (i.e., can be passed
and can return null) its use of the, a bit misleading,
g_return_val_if_fail[2] voids that, as passing NULL emits an
warning[2] which looks pretty grave (assertion failure), albeit is
just noise..

[0]: https://developer.gnome.org/glib/stable/glib-Strings.html#g-string-free
[1]: https://salsa.debian.org/gnome-team/glib/blob/debian/2.58.3-2/glib/gstring.c#L196
[2]: https://developer.gnome.org/glib/stable/glib-Warnings-and-Assertions.html#g-return-val-if-fail

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
data/src/status.c

index 67e644933396725d7110dc83b3f7c432eb648902..e437476163942fed49fe74657596bbe06ce5c611 100644 (file)
@@ -920,7 +920,9 @@ cfs_create_guest_conf_property_msg(GString *str, memdb_t *memdb, const char *pro
        }
 ret:
        g_free(tmp);
-       g_string_free(path, TRUE);
+       if (path != NULL) {
+               g_string_free(path, TRUE);
+       }
        g_string_append_printf(str,"\n}\n");
        g_mutex_unlock (&mutex);