Explorar o código

p_usrloc: fix dereference before null check in code path

Lucian Balaceanu %!s(int64=8) %!d(string=hai) anos
pai
achega
d58fdb7c4e
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      src/modules/p_usrloc/ul_db_query.c

+ 4 - 2
src/modules/p_usrloc/ul_db_query.c

@@ -37,13 +37,15 @@ int db_query(ul_db_handle_t * handle, db1_con_t *** _r_h, db_func_t ** _r_f,
 	int i;
 	int err[DB_NUM];
 	int ret = -1;
-	order_dbs(handle, order);
-	memset(err, 0 , sizeof(int) * DB_NUM);
 
 	if(!handle || !table || !table->s || !_r_h) {
 		LM_ERR("NULL pointer in parameter.\n");
 		return -1;
 	}
+
+	order_dbs(handle, order);
+	memset(err, 0 , sizeof(int) * DB_NUM);
+
 	i = 0;
 	do {
 		LM_DBG("now trying id %i, db %i.\n", handle->id, handle->db[order[i]].no);