Print this page
5679 be_sort_list(): Possible null pointer dereference

@@ -24,10 +24,11 @@
  */
 
 /*
  * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
  * Copyright 2015 Toomas Soome <tsoome@me.com>
+ * Copyright 2015 Gary Mills
  */
 
 /*
  * System includes
  */

@@ -1176,12 +1177,20 @@
         case BE_SUCCESS:
                 /* the default sort is ascending date, no need to sort twice */
                 if (order == BE_SORT_UNSPECIFIED)
                         order = BE_SORT_DATE;
 
-                if (order != BE_SORT_DATE)
-                        be_sort(&be_nodes, order);
+                if (order != BE_SORT_DATE) {
+                        err = be_sort(&be_nodes, order);
+                        if (err != BE_SUCCESS) {
+                                (void) fprintf(stderr, _("Unable to sort Boot "
+                                    "Environment\n"));
+                                (void) fprintf(stderr, "%s\n",
+                                    be_err_to_str(err));
+                                break;
+                        }
+                }
 
                 print_nodes(be_name, dsets, snaps, parsable, be_nodes);
                 break;
         case BE_ERR_BE_NOENT:
                 if (be_name == NULL)