Changeset 86d7bfa in mainline


Ignore:
Timestamp:
2011-02-02T20:37:53Z (13 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8b5690f, fc47885
Parents:
1e00216
Message:

avoid possible segfaults on error paths when a fibril fails to be created

Location:
uspace
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/test2/test2.c

    r1e00216 r86d7bfa  
    103103        if (dev->parent == NULL) {
    104104                fid_t postpone = fibril_create(postponed_birth, dev);
     105                if (postpone == 0) {
     106                        printf(NAME ": fibril_create() error\n");
     107                        return ENOMEM;
     108                }
    105109                fibril_add_ready(postpone);
    106110        } else {
  • uspace/lib/c/generic/async.c

    r1e00216 r86d7bfa  
    439439       
    440440        fid_t fid = fibril_create(notification_fibril, msg);
     441        if (fid == 0) {
     442                free(msg);
     443                futex_up(&async_futex);
     444                return false;
     445        }
     446       
    441447        fibril_add_ready(fid);
    442448       
     
    689695        conn->wdata.fid = fibril_create(connection_fibril, conn);
    690696       
    691         if (!conn->wdata.fid) {
     697        if (conn->wdata.fid == 0) {
    692698                free(conn);
     699               
    693700                if (callid)
    694701                        ipc_answer_0(callid, ENOMEM);
     702               
    695703                return (uintptr_t) NULL;
    696704        }
     
    861869{
    862870        fid_t fid = fibril_create(async_manager_fibril, NULL);
    863         fibril_add_manager(fid);
     871        if (fid != 0)
     872                fibril_add_manager(fid);
    864873}
    865874
Note: See TracChangeset for help on using the changeset viewer.