Changeset 9f9c7fd in mainline for uspace/lib/net/generic/socket_core.c


Ignore:
Timestamp:
2010-10-16T14:50:42Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
faa3588
Parents:
614d065
Message:

Do not leak the lenghts array in case of error.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/net/generic/socket_core.c

    r614d065 r9f9c7fd  
    564564               
    565565                // write the fragment lengths
    566                 ERROR_PROPAGATE(data_reply(lengths,
    567                     sizeof(int) * (fragments + 1)));
     566                if (ERROR_OCCURRED(data_reply(lengths,
     567                    sizeof(int) * (fragments + 1)))) {
     568                        free(lengths);
     569                        return ERROR_CODE;
     570                }
    568571                next_packet = packet;
    569572               
    570573                // write the fragments
    571574                for (index = 0; index < fragments; ++index) {
    572                         ERROR_PROPAGATE(data_reply(packet_get_data(next_packet),
    573                             lengths[index]));
     575                        ERROR_CODE = data_reply(packet_get_data(next_packet),
     576                            lengths[index]);
     577                        if (ERROR_OCCURRED(ERROR_CODE)) {
     578                                free(lengths);
     579                                return ERROR_CODE;
     580                        }
    574581                        next_packet = pq_next(next_packet);
    575582                }
Note: See TracChangeset for help on using the changeset viewer.