summaryrefslogtreecommitdiff
path: root/gr-fcd/lib
diff options
context:
space:
mode:
authorBen Hilburn <ben.hilburn@ettus.com>2013-10-04 08:48:59 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2013-10-05 09:48:14 -0400
commitacef604f11fef337d37049ca2faeb58548aa0ab8 (patch)
treeee4b57e0e894d2d0b88b1aff707a8be8297ad9c4 /gr-fcd/lib
parent8b3eec1efb89d7375fa3286eed4bacd104e9f56c (diff)
CID: 1088855. Fixing resource leak issues in fcdOpen
Diffstat (limited to 'gr-fcd/lib')
-rw-r--r--gr-fcd/lib/fcd/fcd.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/gr-fcd/lib/fcd/fcd.c b/gr-fcd/lib/fcd/fcd.c
index 011d77be96..693f5fb81c 100644
--- a/gr-fcd/lib/fcd/fcd.c
+++ b/gr-fcd/lib/fcd/fcd.c
@@ -62,24 +62,15 @@ static hid_device *fcdOpen(void)
}
pszPath=strdup(phdi->path);
- if (pszPath==NULL)
- {
- return NULL;
- }
-
- hid_free_enumeration(phdi);
- phdi=NULL;
+ if(pszPath != NULL) {
+ phd = hid_open_path(pszPath);
- if ((phd=hid_open_path(pszPath)) == NULL)
- {
free(pszPath);
- pszPath=NULL;
-
- return NULL;
+ } else {
+ phd = NULL;
}
- free(pszPath);
- pszPath=NULL;
+ hid_free_enumeration(phdi);
return phd;
}