Try to fix invalid free()
This commit is contained in:
parent
d6118a214d
commit
0d62fca3d4
2 changed files with 8 additions and 2 deletions
|
@ -180,7 +180,9 @@ int on_err(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
|
||||||
// 1. If has a "used" buffer, remove it
|
// 1. If has a "used" buffer, remove it
|
||||||
bp = g_hash_table_lookup (app_ctx->used_buffer, &(fdinfo->fd));
|
bp = g_hash_table_lookup (app_ctx->used_buffer, &(fdinfo->fd));
|
||||||
if (bp != NULL) {
|
if (bp != NULL) {
|
||||||
|
fprintf(stderr, "begin removing entry in app_ctx->used_buffer for %s\n", fdinfo->url);
|
||||||
g_hash_table_remove (app_ctx->used_buffer, &(fdinfo->fd));
|
g_hash_table_remove (app_ctx->used_buffer, &(fdinfo->fd));
|
||||||
|
fprintf(stderr, "end removing entry in app_ctx->used_buffer\n");
|
||||||
memset(bp, 0, sizeof(struct buffer_packet));
|
memset(bp, 0, sizeof(struct buffer_packet));
|
||||||
g_queue_push_tail(app_ctx->free_buffer, bp);
|
g_queue_push_tail(app_ctx->free_buffer, bp);
|
||||||
}
|
}
|
||||||
|
@ -191,7 +193,11 @@ int on_err(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
|
||||||
memset(bp, 0, sizeof(struct buffer_packet));
|
memset(bp, 0, sizeof(struct buffer_packet));
|
||||||
g_queue_push_tail(app_ctx->free_buffer, bp);
|
g_queue_push_tail(app_ctx->free_buffer, bp);
|
||||||
}
|
}
|
||||||
|
if (writew) {
|
||||||
|
fprintf(stderr, "begin removing entry in app_ctx->write_waiting for %s\n", fdinfo->url);
|
||||||
g_hash_table_remove (app_ctx->write_waiting, &(fdinfo->fd));
|
g_hash_table_remove (app_ctx->write_waiting, &(fdinfo->fd));
|
||||||
|
fprintf(stderr, "end removing entry in app_ctx->write_waiting for %s\n", fdinfo->url);
|
||||||
|
}
|
||||||
|
|
||||||
// 3. If appears in the read waiting queue, remove it
|
// 3. If appears in the read waiting queue, remove it
|
||||||
g_queue_remove_all (app_ctx->read_waiting, &(fdinfo->fd));
|
g_queue_remove_all (app_ctx->read_waiting, &(fdinfo->fd));
|
||||||
|
|
|
@ -477,7 +477,7 @@ int rr_on_err(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
|
||||||
memset(bp, 0, sizeof(struct buffer_packet));
|
memset(bp, 0, sizeof(struct buffer_packet));
|
||||||
g_queue_push_tail(app_ctx->free_buffer, bp);
|
g_queue_push_tail(app_ctx->free_buffer, bp);
|
||||||
}
|
}
|
||||||
g_hash_table_remove (app_ctx->write_waiting, &(fdinfo->fd));
|
if (writew) g_hash_table_remove (app_ctx->write_waiting, &(fdinfo->fd));
|
||||||
|
|
||||||
// 3. If appears in the read waiting queue, remove it
|
// 3. If appears in the read waiting queue, remove it
|
||||||
g_queue_remove_all (app_ctx->read_waiting, &(fdinfo->fd));
|
g_queue_remove_all (app_ctx->read_waiting, &(fdinfo->fd));
|
||||||
|
|
Loading…
Reference in a new issue