ulist_alloc() has the possibility of returning NULL.
So, it is necessary to check the return value.
Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
         * be exceeded
         */
        ulist = ulist_alloc(GFP_ATOMIC);
+       if (!ulist) {
+               ret = -ENOMEM;
+               goto out;
+       }
        ulist_add(ulist, qgroup->qgroupid, (uintptr_t)qgroup, GFP_ATOMIC);
        ULIST_ITER_INIT(&uiter);
        while ((unode = ulist_next(ulist, &uiter))) {
                goto out;
 
        ulist = ulist_alloc(GFP_ATOMIC);
+       if (!ulist) {
+               btrfs_std_error(fs_info, -ENOMEM);
+               goto out;
+       }
        ulist_add(ulist, qgroup->qgroupid, (uintptr_t)qgroup, GFP_ATOMIC);
        ULIST_ITER_INIT(&uiter);
        while ((unode = ulist_next(ulist, &uiter))) {