Clean up memory leaks
This commit is contained in:
@@ -385,6 +385,7 @@ long dbJLinkParse(const char *json, size_t jlen, short dbfType,
|
||||
err = yajl_get_error(yh, 1, (const unsigned char *) json, (unsigned) jlen);
|
||||
errlogPrintf("dbJLinkInit: %s\n", err);
|
||||
yajl_free_error(yh, err);
|
||||
dbJLinkFree(parser->pjlink);
|
||||
/* fall through */
|
||||
default:
|
||||
status = S_db_badField;
|
||||
|
||||
@@ -177,6 +177,8 @@ void dbRemoveLink(struct dbLocker *locker, struct link *plink)
|
||||
plset->removeLink(locker, plink);
|
||||
plink->lset = NULL;
|
||||
}
|
||||
if (plink->type == JSON_LINK)
|
||||
plink->value.json.jlink = NULL;
|
||||
}
|
||||
|
||||
int dbLinkIsDefined(const struct link *plink)
|
||||
|
||||
@@ -2235,7 +2235,6 @@ long dbInitRecordLinks(dbRecordType *rtyp, struct dbCommon *prec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
void dbFreeLinkInfo(dbLinkInfo *pinfo)
|
||||
{
|
||||
if (pinfo->ltype == JSON_LINK) {
|
||||
@@ -2282,12 +2281,11 @@ long dbParseLink(const char *str, short ftype, dbLinkInfo *pinfo)
|
||||
|
||||
/* Check for braces => JSON */
|
||||
if (*str == '{' && str[len-1] == '}') {
|
||||
long status = dbJLinkParse(str, len, ftype, &pinfo->jlink);
|
||||
if (dbJLinkParse(str, len, ftype, &pinfo->jlink))
|
||||
goto fail;
|
||||
|
||||
if (!status)
|
||||
pinfo->ltype = JSON_LINK;
|
||||
|
||||
return status;
|
||||
pinfo->ltype = JSON_LINK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check for other HW link types */
|
||||
|
||||
@@ -74,6 +74,8 @@ long dbCanSetLink(DBLINK *plink, dbLinkInfo *pinfo, devSup *devsup);
|
||||
* Unconditionally takes ownership of pinfo->target
|
||||
*/
|
||||
long dbSetLink(DBLINK *plink, dbLinkInfo *pinfo, devSup *dset);
|
||||
/* Free dbLinkInfo storage */
|
||||
epicsShareFunc void dbFreeLinkInfo(dbLinkInfo *pinfo);
|
||||
|
||||
/* The following is for path */
|
||||
typedef struct dbPathNode {
|
||||
|
||||
Reference in New Issue
Block a user