]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
libsubid_init: return false if out of memory 341/head
authorSerge Hallyn <serge@hallyn.com>
Mon, 17 May 2021 13:48:03 +0000 (08:48 -0500)
committerSerge Hallyn <serge@hallyn.com>
Mon, 17 May 2021 13:49:01 +0000 (08:49 -0500)
The rest of the run isn't likely to get much better, is it?

Thanks to Alexey for pointing this out.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
Cc: Alexey Tikhonov <atikhono@redhat.com>
libsubid/api.c

index 8ca098590ca9bf4ecc9f0d69daa38f1762fabb74..8618e500540e1510e9c6f371a97fbc77d2fd52a4 100644 (file)
@@ -46,10 +46,12 @@ bool libsubid_init(const char *progname, FILE * logfd)
 {
        if (progname) {
                progname = strdup(progname);
-               if (progname)
+               if (progname) {
                        Prog = progname;
-               else
+               } else {
                        fprintf(stderr, "Out of memory");
+                       return false;
+               }
        }
 
        if (logfd) {