VirtualBox

Changeset 103114 in vbox for trunk


Ignore:
Timestamp:
Jan 30, 2024 8:30:58 AM (13 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
161361
Message:

xpcom/xpt_link.c: Fix possible memory leak, bugref:3409

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/xpcom/typelib/xpt/tools/xpt_link.c

    r40045 r103114  
    212212        }
    213213
     214        whole = XPT_MALLOC(arena, flen);
     215        if (!whole) {
     216            perror("FAILED: XPT_MALLOC for whole");
     217            return 1;
     218        }
     219
    214220        in = fopen(name, "rb");
    215221        if (!in) {
    216222            perror("FAILED: fopen");
    217             return 1;
    218         }
    219 
    220         whole = XPT_MALLOC(arena, flen);
    221         if (!whole) {
    222             perror("FAILED: XPT_MALLOC for whole");
     223            XPT_FREE(arena, whole);
    223224            return 1;
    224225        }
     
    228229            if (rv < flen) {
    229230                fprintf(stderr, "short read (%zd vs %zd)! ouch!\n", rv, flen);
     231                fclose(in);
     232                XPT_FREE(arena, whole);
    230233                return 1;
    231234            }
    232235            if (ferror(in) != 0 || fclose(in) != 0) {
    233236                perror("FAILED: Unable to read typelib file.\n");
     237                XPT_FREE(arena, whole);
    234238                return 1;
    235239            }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette