]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
libctf: dedup: fix a broken error path in string dedup
authorNick Alcock <nick.alcock@oracle.com>
Fri, 25 Apr 2025 17:42:55 +0000 (18:42 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 25 Apr 2025 20:23:07 +0000 (21:23 +0100)
If we run out of memory updating the string counts, set the right errno:
ctf_dynhash_insert returns a *negative* error value, and we want a positive
one in the ctf_errno.

libctf/ctf-dedup.c

index 709bcfb04f5957780559c58c48edcb51ec80aac3..456675252919523c5847c776baebf051b06d8fc9 100644 (file)
@@ -3229,7 +3229,7 @@ ctf_dedup_strings (ctf_dict_t *fp)
 
          if ((err = ctf_dynhash_insert (str_counts, atom->csa_str, (void *) count)) < 0)
            {
-             ctf_set_errno (fp, err);
+             ctf_set_errno (fp, -err);
              ctf_next_destroy (j);
              goto err;
            }