diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2017-10-04 17:23:08 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2017-10-04 17:23:08 (GMT) |
commit | 59aefd51a5c526b5d5e88cdc19cd6bf4b05995f4 (patch) | |
tree | d449523bb24ed3148869060687dfc41a167576b7 /tksao | |
parent | 3802d3df703ae75262c86187cad4d3bae745a9ca (diff) | |
download | blt-59aefd51a5c526b5d5e88cdc19cd6bf4b05995f4.zip blt-59aefd51a5c526b5d5e88cdc19cd6bf4b05995f4.tar.gz blt-59aefd51a5c526b5d5e88cdc19cd6bf4b05995f4.tar.bz2 |
track down memory leaks with getString
Diffstat (limited to 'tksao')
-rw-r--r-- | tksao/fitsy++/file.C | 14 | ||||
-rw-r--r-- | tksao/fitsy++/file.h | 1 | ||||
-rw-r--r-- | tksao/fitsy++/head.C | 11 | ||||
-rw-r--r-- | tksao/fitsy++/head.h | 1 |
4 files changed, 27 insertions, 0 deletions
diff --git a/tksao/fitsy++/file.C b/tksao/fitsy++/file.C index b871601..059854d 100644 --- a/tksao/fitsy++/file.C +++ b/tksao/fitsy++/file.C @@ -471,6 +471,20 @@ void FitsFile::getComplex(const char* name, double* real, double* img, *img = idef; } +char* FitsFile::getString(const char* name) +{ + if (head_) { + char* r = head_->getString(name); + if (r) + return r; + else + if (primary_ && inherit_) + return primary_->getString(name); + } + + return NULL; +} + char* FitsFile::getStringCopy(const char* name) { if (head_) { diff --git a/tksao/fitsy++/file.h b/tksao/fitsy++/file.h index f3e9c9d..a665fee 100644 --- a/tksao/fitsy++/file.h +++ b/tksao/fitsy++/file.h @@ -212,6 +212,7 @@ public: double getReal(const char* name, double def); void getComplex(const char* name, double* real, double* img, double rdef, double idef); + char* getString(const char* name); char* getStringCopy(const char* name); char* getComment(const char* name); char* getKeyword(const char* name); diff --git a/tksao/fitsy++/head.C b/tksao/fitsy++/head.C index 133abda..75f5749 100644 --- a/tksao/fitsy++/head.C +++ b/tksao/fitsy++/head.C @@ -326,6 +326,17 @@ void FitsHead::getComplex(const char* name, double* real, double* img, } } +char* FitsHead::getString(const char* name) +{ + char* card = find(name); + if (card) { + FitsCard c(card); + return c.getString(); + } + else + return NULL; +} + char* FitsHead::getStringCopy(const char* name) { char* card = find(name); diff --git a/tksao/fitsy++/head.h b/tksao/fitsy++/head.h index cbc4b9d..6c91323 100644 --- a/tksao/fitsy++/head.h +++ b/tksao/fitsy++/head.h @@ -121,6 +121,7 @@ public: double getReal(const char* name, double def); void getComplex(const char* name, double* real, double* img, double rdef, double idef); + char* getString(const char* name); char* getStringCopy(const char* name); char* getComment(const char* name); |