summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-05-26 18:59:55 +0200
committerGravatar Nikias Bassen2019-05-26 18:59:55 +0200
commit7b007832f6e6106f2fb2eba896efc69e38dfe374 (patch)
tree50046fdc3abcfd0d62b5a2163e30d0f379830d18 /src
parent7430eec6dc7251275559dd4705aaa068af49e5f6 (diff)
downloadlibusbmuxd-7b007832f6e6106f2fb2eba896efc69e38dfe374.tar.gz
libusbmuxd-7b007832f6e6106f2fb2eba896efc69e38dfe374.tar.bz2
Remove unnecessary NULL pointer checks
Diffstat (limited to 'src')
-rw-r--r--src/libusbmuxd.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/libusbmuxd.c b/src/libusbmuxd.c
index 4553d90..3987aca 100644
--- a/src/libusbmuxd.c
+++ b/src/libusbmuxd.c
@@ -498,8 +498,7 @@ static int usbmuxd_get_result(int sfd, uint32_t tag, uint32_t *result, void **re
memcpy(result, res, sizeof(uint32_t));
ret = 1;
}
- if (res)
- free(res);
+ free(res);
return ret;
} else if (hdr.message == MESSAGE_PLIST) {
if (!result_plist) {
@@ -512,8 +511,7 @@ static int usbmuxd_get_result(int sfd, uint32_t tag, uint32_t *result, void **re
}
LIBUSBMUXD_DEBUG(1, "%s: Unexpected message of type %d received!\n", __func__, hdr.message);
- if (res)
- free(res);
+ free(res);
return -EPROTO;
}
@@ -1074,9 +1072,7 @@ static int get_next_event(int sfd)
} else if (hdr.length > 0) {
LIBUSBMUXD_DEBUG(1, "%s: Unexpected message type %d length %d received!\n", __func__, hdr.message, hdr.length);
}
- if (payload) {
- free(payload);
- }
+ free(payload);
return 0;
}
@@ -1363,8 +1359,7 @@ retry:
} else {
LIBUSBMUXD_DEBUG(1, "%s: Unexpected message %d\n", __func__, hdr.message);
}
- if (payload)
- free(payload);
+ free(payload);
} else {
// we _should_ have all of them now.
// or perhaps an error occured.