Changeset a12f7f1 in mainline


Ignore:
Timestamp:
2011-07-21T02:24:41Z (13 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cfbb5d18
Parents:
94f8b81c
Message:

All occurences of call to native free() secured from passing NULL pointer.

Location:
uspace/lib/posix
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/fnmatch.c

    r94f8b81c ra12f7f1  
    553553
    554554        if ((flags & FNM_CASEFOLD) != 0) {
    555                 free((char *) pattern);
    556                 free((char *) string);
     555                if (pattern) {
     556                        free((char *) pattern);
     557                }
     558                if (string) {
     559                        free((char *) string);
     560                }
    557561        }
    558562
  • uspace/lib/posix/locale.c

    r94f8b81c ra12f7f1  
    127127void posix_freelocale(posix_locale_t locobj)
    128128{
    129         free(locobj);
     129        if (locobj) {
     130                free(locobj);
     131        }
    130132}
    131133
  • uspace/lib/posix/stdio/scanf.c

    r94f8b81c ra12f7f1  
    303303        self->fetched = 0;
    304304        self->cursor = NULL;
    305         free(self->window);
    306         self->window = NULL;
     305        if (self->window) {
     306                free(self->window);
     307                self->window = NULL;
     308        }
    307309        self->window_size = 0;
    308310        self->state = _PROV_CONSTRUCTED;
     
    653655                                /* Update the cursor so it can be returned to the provider. */
    654656                                cur_borrowed += cur_updated - cur_limited;
    655                                 if (width != -1) {
     657                                if (width != -1 && cur_limited != NULL) {
    656658                                        /* Deallocate duplicated part of the cursor view. */
    657659                                        free(cur_limited);
     
    833835                                /* Update the cursor so it can be returned to the provider. */
    834836                                cur_borrowed += cur_updated - cur_limited;
    835                                 if (width != -1) {
     837                                if (width != -1 && cur_limited != NULL) {
    836838                                        /* Deallocate duplicated part of the cursor view. */
    837839                                        free(cur_limited);
  • uspace/lib/posix/time.c

    r94f8b81c ra12f7f1  
    968968        if (task_stats) {
    969969                total_cycles = (posix_clock_t) (task_stats->kcycles + task_stats->ucycles);
    970         }
    971         free(task_stats);
    972         task_stats = 0;
     970                free(task_stats);
     971                task_stats = 0;
     972        }
    973973
    974974        return total_cycles;
Note: See TracChangeset for help on using the changeset viewer.