From 7b007832f6e6106f2fb2eba896efc69e38dfe374 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Sun, 26 May 2019 18:59:55 +0200 Subject: Remove unnecessary NULL pointer checks --- src/libusbmuxd.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src') 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. -- cgit v1.1-32-gdbae