forked from sailfishos/ofono
		
	simfs: Fix crash
0  0x00007ffff7b20517 in g_queue_is_empty () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
1  0x00005555556adcdd in sim_fs_op_free (pointer=0x5555559cb990) at src/simfs.c:101
2  0x00007ffff7b205fc in g_queue_foreach () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
3  0x00007ffff7b2065b in g_queue_free_full () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
4  0x00005555556add81 in sim_fs_free (fs=0x5555559c0780) at src/simfs.c:125
5  0x00005555556828f3 in sim_remove (atom=0x5555559cb000) at src/sim.c:3175
6  0x000055555564f16f in flush_atoms (modem=0x555555a8fb00, new_state=MODEM_STATE_POWER_OFF) at src/modem.c:432
7  0x000055555564f3bd in modem_change_state (modem=0x555555a8fb00, new_state=MODEM_STATE_POWER_OFF)
    at src/modem.c:510
8  0x000055555564ff99 in set_powered (modem=0x555555a8fb00, powered=0) at src/modem.c:896
9  0x000055555565074c in modem_set_property (conn=0x55555596c8d0, msg=0x55555596e460, data=0x555555a8fb00)
    at src/modem.c:1120
			
			
This commit is contained in:
		
				
					committed by
					
						
						Slava Monich
					
				
			
			
				
	
			
			
			
						parent
						
							af1a569430
						
					
				
				
					commit
					1176662a81
				
			@@ -98,10 +98,8 @@ static void sim_fs_op_free(gpointer pointer)
 | 
			
		||||
	struct sim_fs *fs = node->context->fs;
 | 
			
		||||
 | 
			
		||||
	/* only release the session if there are no pending reads */
 | 
			
		||||
	if (fs->session && g_queue_is_empty(fs->op_q)) {
 | 
			
		||||
	if (fs->watch_id && g_queue_is_empty(fs->op_q))
 | 
			
		||||
		__ofono_sim_remove_session_watch(fs->session, fs->watch_id);
 | 
			
		||||
		fs->watch_id = 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	g_free(node->buffer);
 | 
			
		||||
	g_free(node);
 | 
			
		||||
@@ -923,6 +921,13 @@ static void session_read_info_cb(const struct ofono_error *error,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void session_destroy_cb(void *userdata)
 | 
			
		||||
{
 | 
			
		||||
	struct sim_fs *fs = userdata;
 | 
			
		||||
 | 
			
		||||
	fs->watch_id = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void get_session_cb(ofono_bool_t active, int session_id,
 | 
			
		||||
		void *data)
 | 
			
		||||
{
 | 
			
		||||
@@ -999,7 +1004,7 @@ static gboolean sim_fs_op_next(gpointer user_data)
 | 
			
		||||
			else
 | 
			
		||||
				fs->watch_id = __ofono_sim_add_session_watch(
 | 
			
		||||
						fs->session, get_session_cb,
 | 
			
		||||
						fs, NULL);
 | 
			
		||||
						fs, session_destroy_cb);
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		switch (op->structure) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user