IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7847


Ignore:
Timestamp:
Jul 7, 2006, 5:17:13 PM (20 years ago)
Author:
drobbin
Message:

Fixed memory leaks in psMetadataConfig (p_psMetadataKeyArray) from recent fix. Added some doxygen to psLine

Location:
trunk/psLib/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sys/psLine.h

    r7380 r7847  
    77#define PS_LINE_H
    88
    9 // structure to carry a dynamic string
     9/** Structure to carry a dynamic string */
    1010typedef struct
    1111{
    12     long NLINE;                 // allocated length
    13     long Nline;                 // current length
    14     char *line;                 // character string data
     12    long NLINE;                        ///< allocated length
     13    long Nline;                        ///< current length
     14    char *line;                        ///< character string data
    1515}
    1616psLine;
    1717
    18 // allocate a line object of length Nline
    19 psLine *psLineAlloc(long Nline);
     18/** Allocates a line object of length Nline
     19 *
     20 *  @return psLine*:        the newly allocated line object.
     21*/
     22psLine *psLineAlloc(
     23    long Nline                         ///<
     24);
    2025
    21 // (re-)init the line
    22 bool psLineInit(psLine *line);
     26/** Initializes or re-initializes a line.
     27 *
     28 *  Initializes or re-initializes a line, setting the current length to zero and setting
     29 *  the string data values to 0.  If the function is passed NULL, false is returned.
     30 *
     31 *  @return bool:       True if successful, otherwise false.
     32*/
     33bool psLineInit(
     34    psLine *line                       ///<
     35);
    2336
    24 // add the new string segment to the line
    25 bool psLineAdd(psLine *line, const char *format, ...);
     37/** Adds the line segment to the string.
     38 *
     39 *  Appends a line segment to the string, returning false if the new segment would
     40 *  overflow the allocated string length.
     41 *
     42 *  @return bool:        True if successful, otherwise false.
     43*/
     44bool psLineAdd(
     45    psLine *line,                      ///< the line segment to append
     46    const char *format,                ///< printf-style format of line
     47    ...                                ///< any parameters required in format
     48);
    2649
    2750#endif /* PS_LINE_H */
  • trunk/psLib/src/types/psMetadataConfig.c

    r7832 r7847  
    1010*  @author Eric Van Alst, MHPCC
    1111*
    12 *  @version $Revision: 1.63 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2006-07-07 02:25:54 $
     12*  @version $Revision: 1.64 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2006-07-08 03:17:13 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    616616    items = template->list->n;
    617617    if(items > 0 ) {
    618 
    619618        // Allocate metadata
    620619        md = psMetadataAlloc()
    621620             ;
    622 
    623621        // Point to first item in template
    624622        iter = psListIteratorAlloc(template->
    625623                                   list,PS_LIST_HEAD,true);
    626 
    627624        // For each item in template parse line string for values
    628625        for(psS32 i = 0;
    629626                i < items;
    630627                i++) {
    631 
    632628            // Get template item
    633629            templateItem = psListGetAndIncrement(iter)
     
    635631            if(templateItem == NULL) {
    636632                psFree(md);
     633                psFree(iter);
    637634                md = NULL;
    638635                break;
    639636            }
    640 
    641637            // Get the next token on the line
    642638            token = getToken(&linePtr," ",&status,false);
     
    648644                    md = NULL;
    649645                    psFree(token);
     646                    psFree(iter);
    650647                    break;
    651648                }
     
    656653                    psFree(mdItem);
    657654                    psFree(token);
     655                    psFree(iter);
    658656                    break;
    659657                }
     
    662660                // Missing items
    663661                psFree(md);
     662                psFree(iter);
    664663                md = NULL;
    665664                break;
     
    668667            psFree(token);
    669668        }
    670         psFree(iter);
     669        //        psFree(iter);
    671670    }
    672671    return md;
     
    15061505            psFree(keys);
    15071506            psFree(format);
     1507            psFree(str);
    15081508            return NULL;
    15091509        }
     
    15421542                psFree(str);
    15431543            }
     1544            psFree(iter);
    15441545        }
    15451546        break;
     
    18041805            }
    18051806        }
    1806         psArrayAdd(keys, 0, psStringCopy(item->name));
    1807     }
    1808 
     1807        psString string = psStringCopy(item->name);
     1808        psArrayAdd(keys, 0, string);
     1809        psFree(string);
     1810    }
     1811    psFree(iter);
    18091812    return keys;
    18101813}
Note: See TracChangeset for help on using the changeset viewer.