IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11667


Ignore:
Timestamp:
Feb 6, 2007, 10:47:15 AM (19 years ago)
Author:
gusciora
Message:

Fixed memory leaks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/types/tap_psMetadataConfigFormat.c

    r10701 r11667  
    1818int main(void)
    1919{
    20     plan_tests(13);
     20    plan_tests(19);
    2121
    2222    psMetadata *md = NULL;
     
    2727    //Return NULL for NULL metadata input
    2828    {
     29        psMemId id = psMemGetId();
    2930        out = psMetadataConfigFormat(md);
    3031        ok( out == NULL,
    3132            "psMetadataConfigFormat:         return NULL for NULL metadata input.");
     33        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    3234    }
     35
     36
    3337    //Return NULL for empty metadata input
    3438    {
     
    3842            "psMetadataConfigFormat:         return NULL for empty metadata input.");
    3943    }
     44
     45
    4046    //Return NULL for metadata with missing hash table
    4147    {
     
    5056        md->hash = temp;
    5157    }
     58
     59
    5260    //Return NULL for metadata containing a psList
    5361    {
     
    6068        psFree(md);
    6169    }
     70
     71
    6272    //Return NULL for attempting to format vector with type = complex
    6373    {
     74        psMemId id = psMemGetId();
    6475        psVector *vec = psVectorAlloc(60, PS_TYPE_C64);
    6576        for (int i = 0; i < 5; i++)
     
    7485            "Complex vector.");
    7586        psFree(vec);
     87        psFree(md);
     88        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    7689    }
     90
     91
    7792    //Return NULL for attempting to format psTime with type = -1
    7893    {
    79         psFree(md);
     94        psMemId id = psMemGetId();
    8095        md = psMetadataAlloc();
    8196        psTime *time = psTimeAlloc(PS_TIME_TT);
     
    87102            "invalid time type.");
    88103        psFree(time);
     104        psFree(md);
     105        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    89106    }
     107
     108
    90109    //Return valid metadata for attempting to format NULL psTime metadataItem
    91110    {
    92         psFree(md);
     111        psMemId id = psMemGetId();
    93112        md = psMetadataAlloc();
    94113        psTime *time = psTimeAlloc(PS_TIME_TT);
     
    108127        psFree(out);
    109128        out = NULL;
     129        psFree(md);
     130        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    110131    }
     132
     133
    111134    //Return valid metadata for attempting to format NULL psTime metadataItem
    112135    {
    113         psFree(md);
     136        psMemId id = psMemGetId();
    114137        md = psMetadataAlloc();
    115138        psMetadataAddS32(md, PS_LIST_HEAD, "new_S32", 0, NULL, 666);
     
    125148        psFree(out);
    126149        out = NULL;
     150        psFree(md);
     151        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    127152    }
     153
     154
    128155    //Return valid metadata for attempting to format NULL psTime metadataItem
    129156    {
    130         psFree(md);
     157        psMemId id = psMemGetId();
    131158        md = psMetadataAlloc();
    132159        psMetadataAddS32(md, PS_LIST_HEAD, "f32", 0, "f32_1", 666);
     
    147174        psFree(out);
    148175        out = NULL;
     176        psFree(md);
     177        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    149178    }
    150179
Note: See TracChangeset for help on using the changeset viewer.