From: Jouni Malinen Date: Mon, 5 Jan 2015 21:46:24 +0000 (+0200) Subject: eloop: Fix WPA_TRACE tracking in case of realloc failure X-Git-Tag: hostap_2_4~522 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9f6560f38ff4762c2cae83737cf100e6586e14d;p=thirdparty%2Fhostap.git 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 --- diff --git a/src/utils/eloop.c b/src/utils/eloop.c index 0da6de45e..4a565ebdb 100644 --- a/src/utils/eloop.c +++ b/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;