]> rtime.felk.cvut.cz Git - frescor/frsh.git/blobdiff - fres/cbroker/fcb.c
Updated error checking of forb_sequence_alloc_buf()
[frescor/frsh.git] / fres / cbroker / fcb.c
index 4c8efcdcd62ec2fcf9620a963e9a9cfab5e9e37e..116789332bf555a41bd083250c1ce9656f234ea0 100644 (file)
@@ -416,7 +416,9 @@ rebalance_spare_capacity_and_reserve(struct resource *resource,
        fres_block_spare_capacity *s;
 
        fres_contract_ptr_seq contracts;
-       forb_sequence_alloc_buf(contracts, rl->length);
+       if (!forb_sequence_alloc_buf(contracts, rl->length)) {
+               return errno;
+       }
        contracts._length = rl->length;
        i=0;
        /* Initialize optimization */
@@ -531,7 +533,9 @@ change_vreses(struct fcb *fcb, fres_contract_ptr_seq *schedulable_contracts)
        int i, ret;
        CORBA_Environment ev;
        
-       forb_sequence_alloc_buf(vreses, schedulable_contracts->_length);
+       if (!forb_sequence_alloc_buf(vreses, schedulable_contracts->_length)) {
+               return errno;
+       }
        vreses._length = 0;
        
        for (i=0; i<schedulable_contracts->_length; i++) {
@@ -617,8 +621,7 @@ negotiate_contracts(fres_contract_broker obj,
        /* Allocate all the needed memory before doing reservation. If
         * there is no enough memory, it has no sense to call resource
         * manager. */
-       forb_sequence_alloc_buf(commit_ids, rl.length);
-       if (!commit_ids._buffer) {
+       if (!forb_sequence_alloc_buf(commit_ids, rl.length)) {
                ret = errno;
                goto err_free_fcb_contracts;
        }
@@ -687,8 +690,7 @@ negotiate_contracts(fres_contract_broker obj,
 
 
        /* Return IDs and delete canceled contracts from out database */
-       forb_sequence_alloc_buf(**ids_out, contracts->_length);
-       if (!(*ids_out)->_buffer) {
+       if (!forb_sequence_alloc_buf(**ids_out, contracts->_length)) {
                ev->major = FORB_EX_NO_MEMORY;
                goto err_cancel_contracts;
        }