summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar BALATON Zoltan2017-07-13 02:00:24 +0200
committerGravatar BALATON Zoltan2017-07-14 12:22:52 +0200
commit260f751a42997e9d72a18fccf4b4ea70c55ea2a6 (patch)
tree922fc7f10fe4f4d0da34b963b15dc19fed44a05f
parent260eec04d51fd986f895b676554b1ff6a1799417 (diff)
downloadlibideviceactivation-260f751a42997e9d72a18fccf4b4ea70c55ea2a6.tar.gz
libideviceactivation-260f751a42997e9d72a18fccf4b4ea70c55ea2a6.tar.bz2
activation: Simplify plist_strip_xml() by removing some unnecessary operations
-rw-r--r--src/activation.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/activation.c b/src/activation.c
index 72e6ee7..0a56dc7 100644
--- a/src/activation.c
+++ b/src/activation.c
@@ -608,8 +608,6 @@ static char* urlencode(const char* buf)
static int plist_strip_xml(char** xmlplist)
{
- uint32_t size = 0;
-
if (!xmlplist || !*xmlplist)
return -1;
@@ -622,16 +620,15 @@ static int plist_strip_xml(char** xmlplist)
return -1;
start += strlen("<plist version=\"1.0\">\n");
- size = stop - start;
+ uint32_t size = stop - start;
char* stripped = malloc(size + 1);
if (!stripped)
return -1;
- memset(stripped, '\0', size + 1);
memcpy(stripped, start, size);
+ stripped[size] = '\0';
free(*xmlplist);
*xmlplist = stripped;
- stripped = NULL;
return 0;
}