eloop: Fix WPA_TRACE tracking in case of realloc failure
authorJouni Malinen <j@w1.fi>
Mon, 5 Jan 2015 21:46:24 +0000 (23:46 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 6 Jan 2015 16:30:20 +0000 (18:30 +0200)
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>
src/utils/eloop.c

index 0da6de4..4a565eb 100644 (file)
@@ -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;