]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
copy: exit immediately upon failure to allocate hash memory
authorPádraig Brady <P@draigBrady.com>
Mon, 3 May 2021 17:53:35 +0000 (18:53 +0100)
committerPádraig Brady <P@draigBrady.com>
Mon, 3 May 2021 17:53:35 +0000 (18:53 +0100)
* src/copy.c (dest_info_init, src_info_init): Terminate immediately
upon memory exhaustion.

src/copy.c

index 3e1abee28916e3b5bd8b0c5ff68db5b458868b6c..af16bab692aac31f9813db56324af74d38a98b26 100644 (file)
@@ -1953,6 +1953,8 @@ dest_info_init (struct cp_options *x)
                        triple_hash,
                        triple_compare,
                        triple_free);
+  if (! x->dest_info)
+    xalloc_die();
 }
 
 /* Initialize the hash table implementing a set of F_triple entries
@@ -1975,6 +1977,8 @@ src_info_init (struct cp_options *x)
                        triple_hash_no_name,
                        triple_compare,
                        triple_free);
+  if (! x->src_info)
+    xalloc_die();
 }
 
 /* When effecting a move (e.g., for mv(1)), and given the name DST_NAME