Print this page
10117 libbe needs smatch fixes

@@ -23,10 +23,11 @@
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
  * Copyright 2016 Toomas Soome <tsoome@me.com>
  * Copyright (c) 2015 by Delphix. All rights reserved.
  * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
+ * Copyright (c) 2018, Joyent, Inc.
  */
 
 
 /*
  * System includes

@@ -268,11 +269,11 @@
                 else
                         (void) asprintf(fbarg, "/ %s %s "
                             "-B zfs-bootfs=%s,bootpath=\"%s\"\n", kernel,
                             kernel_options, node->be_root_ds, tmp);
 
-                if (fbarg == NULL)
+                if (*fbarg == NULL)
                         ret = BE_ERR_NOMEM;
                 else
                         ret = 0;
         } else
                 ret = BE_ERR_NOMEM;

@@ -3906,13 +3907,13 @@
                 return (BE_ERR_BAD_MENU_PATH);
         }
         if (mkdirp(menu_path,
             S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) == -1 &&
             errno != EEXIST) {
-                free(menu_path);
                 be_print_err(gettext("be_create_menu: Failed to create the %s "
                     "directory: %s\n"), menu_path, strerror(errno));
+                free(menu_path);
                 return (errno_to_be_err(errno));
         }
         free(menu_path);
 
         /*