]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-journal: propagate errors from ordered_hashmap_*()
authorFrantisek Sumsal <frantisek@sumsal.cz>
Wed, 24 May 2023 12:17:25 +0000 (14:17 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Wed, 24 May 2023 16:45:06 +0000 (18:45 +0200)
Instead of masking them with -ENOMEM.

src/libsystemd/sd-journal/catalog.c

index 7f1dc0b4ed7c76e131e0556e734d3cbdc8dc31d8..06cf396b95901b22e50dbcf1705edacfe083f439 100644 (file)
@@ -147,6 +147,7 @@ static int finish_item(
         _cleanup_free_ CatalogItem *i = NULL;
         _cleanup_free_ char *combined = NULL;
         char *prev;
+        int r;
 
         assert(h);
         assert(payload);
@@ -169,8 +170,9 @@ static int finish_item(
                 if (!combined)
                         return log_oom();
 
-                if (ordered_hashmap_update(h, i, combined) < 0)
-                        return log_oom();
+                r = ordered_hashmap_update(h, i, combined);
+                if (r < 0)
+                        return r;
 
                 TAKE_PTR(combined);
                 free(prev);
@@ -180,8 +182,9 @@ static int finish_item(
                 if (!combined)
                         return log_oom();
 
-                if (ordered_hashmap_put(h, i, combined) < 0)
-                        return log_oom();
+                r = ordered_hashmap_put(h, i, combined);
+                if (r < 0)
+                        return r;
 
                 TAKE_PTR(i);
                 TAKE_PTR(combined);