#33 merge_ent_array_duplicates: Only use values if valid
Merged a year ago by jhrozek. Opened a year ago by jhrozek.
jhrozek/libuser check_null_values  into  master

file modified
+14 -8

@@ -691,10 +691,13 @@ 

  			while (attributes != NULL) {

  				attr = (const char *)attributes->data;

  				values = lu_ent_get_current(current, attr);

- 				for (j = 0; j < values->n_values; j++) {

- 					value = g_value_array_get_nth(values,

- 								      j);

- 					lu_ent_add_current(saved, attr, value);

+ 				if (values != NULL) {

+ 					for (j = 0; j < values->n_values; j++) {

+ 						value = g_value_array_get_nth(

+ 									values,

+ 									j);

+ 						lu_ent_add_current(saved, attr, value);

+ 					}

  				}

  				attributes = g_list_next(attributes);

  			}

@@ -705,10 +708,13 @@ 

  			while (attributes != NULL) {

  				attr = (const char *)attributes->data;

  				values = lu_ent_get(current, attr);

- 				for (j = 0; j < values->n_values; j++) {

- 					value = g_value_array_get_nth(values,

- 								      j);

- 					lu_ent_add(saved, attr, value);

+ 				if (values != NULL) {

+ 					for (j = 0; j < values->n_values; j++) {

+ 						value = g_value_array_get_nth(

+ 									values,

+ 									j);

+ 						lu_ent_add(saved, attr, value);

+ 					}

  				}

  				attributes = g_list_next(attributes);

  			}

Merges:
https://pagure.io/libuser/issue/22

Don't attempt to dereference a NULL pointer

rebased onto 8da7fc8

a year ago

Commit 85823ae fixes this pull-request

Pull-Request has been merged by jhrozek

a year ago

Pull-Request has been merged by jhrozek

a year ago
Metadata