summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Krishnia-INTERN <nkrishnia@nvidia.com>2017-07-10 10:43:38 -0700
committerAaron Plattner <aplattner@nvidia.com>2017-07-24 10:19:12 -0700
commit88839c2a23c519093a88e8d0d9795566d96bd7ab (patch)
tree7bc8d7c44891344c44de9768647ce8858153ee6c
parent272d6bb9f9e3920b0dd1679605c3835cdad04055 (diff)
Fix for segmentation fault in nvidia-settings when run as non-root user. Fix: Added a Null check for griddConfig.
-rw-r--r--src/gtk+-2.x/ctkgridlicense.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/gtk+-2.x/ctkgridlicense.c b/src/gtk+-2.x/ctkgridlicense.c
index a4e846f..3eae322 100644
--- a/src/gtk+-2.x/ctkgridlicense.c
+++ b/src/gtk+-2.x/ctkgridlicense.c
@@ -1127,23 +1127,26 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target,
ctk_manage_grid_license->license_edition_state = mode;
ctk_manage_grid_license->dbusData = dbusData;
ctk_manage_grid_license->license_edition_gvw_selected = FALSE;
+ ctk_manage_grid_license->feature_type = 0;
/* set default value for feature type based on the user configured parameter or virtualization mode */
- if (strcmp(griddConfig->str[NV_GRIDD_FEATURE_TYPE], "0"))
- {
- ctk_manage_grid_license->feature_type = GRID_LICENSED_FEATURE_TYPE_TESLA;
- }
- else if (strcmp(griddConfig->str[NV_GRIDD_FEATURE_TYPE], "1"))
- {
- ctk_manage_grid_license->feature_type = GRID_LICENSED_FEATURE_TYPE_VGPU;
- }
- else if (strcmp(griddConfig->str[NV_GRIDD_FEATURE_TYPE], "2"))
- {
- ctk_manage_grid_license->feature_type = GRID_LICENSED_FEATURE_TYPE_GVW;
- }
- else
- {
- ctk_manage_grid_license->feature_type = GRID_LICENSED_FEATURE_TYPE_TESLA;
+ if (griddConfig) {
+ if (strcmp(griddConfig->str[NV_GRIDD_FEATURE_TYPE], "0"))
+ {
+ ctk_manage_grid_license->feature_type = GRID_LICENSED_FEATURE_TYPE_TESLA;
+ }
+ else if (strcmp(griddConfig->str[NV_GRIDD_FEATURE_TYPE], "1"))
+ {
+ ctk_manage_grid_license->feature_type = GRID_LICENSED_FEATURE_TYPE_VGPU;
+ }
+ else if (strcmp(griddConfig->str[NV_GRIDD_FEATURE_TYPE], "2"))
+ {
+ ctk_manage_grid_license->feature_type = GRID_LICENSED_FEATURE_TYPE_GVW;
+ }
+ else
+ {
+ ctk_manage_grid_license->feature_type = GRID_LICENSED_FEATURE_TYPE_TESLA;
+ }
}
/* Overwrite feature type in vGPU case */