Browse Source

eloop: Fix WPA_TRACE tracking in case of realloc failure

The socket reference tracking entries need to be restored in case
os_realloc_array() fails when adding a new eloop socket.

Signed-off-by: Jouni Malinen <j@w1.fi>
Jouni Malinen 10 years ago
parent
commit
b9f6560f38
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/utils/eloop.c

+ 3 - 1
src/utils/eloop.c

@@ -242,8 +242,10 @@ static int eloop_sock_table_add_sock(struct eloop_sock_table *table,
 	eloop_trace_sock_remove_ref(table);
 	tmp = os_realloc_array(table->table, table->count + 1,
 			       sizeof(struct eloop_sock));
-	if (tmp == NULL)
+	if (tmp == NULL) {
+		eloop_trace_sock_add_ref(table);
 		return -1;
+	}
 
 	tmp[table->count].sock = sock;
 	tmp[table->count].eloop_data = eloop_data;