diff options
author | Christophe Fergeau | 2008-08-12 22:01:18 +0200 |
---|---|---|
committer | Jonathan Beck | 2008-08-21 18:58:17 +0200 |
commit | 0496edd88632b0bf83a78bbf5f665569f5b71e1a (patch) | |
tree | 57af5ead86b0430228b13f6439bcd74bb6af710e | |
parent | 877fd5089abaa58273c6b251f9ca30c4303e3632 (diff) | |
download | libplist-0496edd88632b0bf83a78bbf5f665569f5b71e1a.tar.gz libplist-0496edd88632b0bf83a78bbf5f665569f5b71e1a.tar.bz2 |
Don't leak "version" in get_iPhone
-rw-r--r-- | src/iphone.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/iphone.c b/src/iphone.c index 2bdb5c8..ecbb751 100644 --- a/src/iphone.c +++ b/src/iphone.c @@ -36,7 +36,6 @@ extern int debug; */ iPhone *get_iPhone() { iPhone *phone = (iPhone*)malloc(sizeof(iPhone)); - usbmux_version_header *version = version_header(); struct usb_bus *bus, *busses; struct usb_device *dev; @@ -79,6 +78,7 @@ iPhone *get_iPhone() { // Send the version command to the phone int bytes = 0; + usbmux_version_header *version = version_header(); bytes = usb_bulk_write(phone->device, BULKOUT, (char*)version, sizeof(*version), 800); if (bytes < 20 && debug) { fprintf(stderr, "get_iPhone(): libusb did NOT send enough!\n"); @@ -93,6 +93,7 @@ iPhone *get_iPhone() { // Check for bad response if (bytes < 20) { + free(version); free_iPhone(phone); free(version); if (debug) fprintf(stderr, "get_iPhone(): Invalid version message -- header too short.\n"); @@ -114,7 +115,6 @@ iPhone *get_iPhone() { if (debug) fprintf(stderr, "get_iPhone(): Received a bad header/invalid version number."); return NULL; } - // If it got to this point it's gotta be bad if (debug) fprintf(stderr, "get_iPhone(): Unknown error.\n"); |