File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,6 +107,9 @@ void list_splice(void *object1, void *object2)
107107{
108108 list_item * to , * from ;
109109
110+ if (object1 == object2 )
111+ return ;
112+
110113 to = list_object_item (object1 );
111114 from = list_object_item (object2 );
112115
Original file line number Diff line number Diff line change @@ -140,13 +140,26 @@ void unit()
140140 list_destruct (& l , NULL );
141141}
142142
143+ void edge ()
144+ {
145+ list l1 ;
146+ int * i ;
147+
148+ list_construct (& l1 );
149+
150+ i = list_push_back (& l1 , (int []){1 }, sizeof (int ));
151+ list_splice (i , i );
152+ list_destruct (& l1 , NULL );
153+ }
154+
143155int main ()
144156{
145157 const struct CMUnitTest tests [] = {
146158 cmocka_unit_test (core ),
147159 cmocka_unit_test (object_release ),
148160 cmocka_unit_test (alloc ),
149- cmocka_unit_test (unit )
161+ cmocka_unit_test (unit ),
162+ cmocka_unit_test (edge )
150163 };
151164
152165 return cmocka_run_group_tests (tests , NULL , NULL );
You can’t perform that action at this time.
0 commit comments