Changeset 04c35fca in mainline for uspace/app/fontviewer/fontviewer.c


Ignore:
Timestamp:
2018-11-23T20:31:50Z (5 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a01f732
Parents:
cf3a905c (diff), 103db908 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jakub Jermář <jakub@…> (2018-11-23 20:31:50)
git-committer:
GitHub <noreply@…> (2018-11-23 20:31:50)
Message:

Merge pull request #62 from maurizio-lombardi/memory_leaks

Fix a few memory leaks in fontviewer and the font library

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/fontviewer/fontviewer.c

    rcf3a905c r04c35fca  
    170170        source_t leading_bg = rgb(170, 238, 255);
    171171        source_t leading_fg = rgb(0, 170, 212);
    172 
    173         font_t *font;
     172        font_t *info_font = NULL;
     173        font_t *font = NULL;
     174
    174175        errno_t rc = create_font(&font, points);
    175176        if (rc != EOK) {
    176177                printf("Failed creating font\n");
    177                 return rc;
    178         }
    179 
    180         font_t *info_font;
     178                goto out_err;
     179        }
     180
    181181        rc = embedded_font_create(&info_font, 16);
    182182        if (rc != EOK) {
    183183                printf("Failed creating info font\n");
    184                 return rc;
     184                goto out_err;
    185185        }
    186186
     
    188188        rc = font_get_metrics(font, &font_metrics);
    189189        if (rc != EOK)
    190                 return rc;
     190                goto out_err;
    191191
    192192        surface_coord_t top = 50;
     
    238238        }
    239239
    240         font_release(font);
    241         return EOK;
     240out_err:
     241        if (font)
     242                font_release(font);
     243        if (info_font)
     244                font_release(info_font);
     245        return rc;
    242246}
    243247
Note: See TracChangeset for help on using the changeset viewer.