summaryrefslogtreecommitdiffstats
path: root/src/fw.c
diff options
context:
space:
mode:
authorGravatar Erik Hovland 2008-09-30 14:05:32 -0700
committerGravatar Dan Dennedy 2008-10-28 22:52:06 -0700
commit709d8791ceadae2c2a0cd3ef9ebdf56e4d7dd27e (patch)
tree4abb2023378f4761df8b482e66c570b4e3915c6f /src/fw.c
parentMake sure variables are initialized before used. (diff)
Protect against resource leaks.
Signed-off-by: Erik Hovland <erik@hovland.org> Signed-off-by: Dan Dennedy <dan@dennedy.org>
Diffstat (limited to 'src/fw.c')
-rw-r--r--src/fw.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/fw.c b/src/fw.c
index 3c61385..a229d1a 100644
--- a/src/fw.c
+++ b/src/fw.c
@@ -501,8 +501,10 @@ fw_handle_t fw_new_handle_on_port(int port)
if (handle == NULL)
return NULL;
- if (fw_set_port(handle, port) < 0)
+ if (fw_set_port(handle, port) < 0) {
+ fw_destroy_handle(handle);
return NULL;
+ }
return handle;
}