]> git.proxmox.com Git - pve-cluster.git/commitdiff
pmxcfs: status: catch possible allocation error
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Sun, 31 Jan 2021 02:08:56 +0000 (03:08 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sun, 31 Jan 2021 02:09:30 +0000 (03:09 +0100)
even if not really realistic to happen in Linux

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

index f3775fdd0c71a3b518a42dc7bc183f40924911d9..8e932211ab442933de58c56f593d7fc17236ee95 100644 (file)
@@ -900,7 +900,11 @@ cfs_create_guest_conf_property_msg(GString *str, memdb_t *memdb, const char *pro
                goto ret;
        }
 
-       path = g_string_sized_new(256);
+       if ((path = g_string_sized_new(256)) == NULL) {
+               res = -ENOMEM;
+               goto ret;
+       }
+
        if (vmid >= 100) {
                vminfo_t *vminfo = (vminfo_t *) g_hash_table_lookup(cfs_status.vmlist, &vmid);
                if (vminfo == NULL) goto enoent;