- mms_utility: fixed memory leak

pull/179/head
Michael Zillgith 6 years ago
parent 31e183d357
commit 83f9f1eaa6

@ -99,7 +99,8 @@ printRawMmsMessage(void* parameter, uint8_t* message, int messageLength, bool re
printf("\n"); printf("\n");
} }
int main(int argc, char** argv) { int main(int argc, char** argv)
{
char* hostname = StringUtils_copyString("localhost"); char* hostname = StringUtils_copyString("localhost");
int tcpPort = 102; int tcpPort = 102;
@ -133,6 +134,7 @@ int main(int argc, char** argv) {
break; break;
case 'h': case 'h':
free(hostname);
hostname = StringUtils_copyString(optarg); hostname = StringUtils_copyString(optarg);
break; break;
case 'p': case 'p':
@ -334,7 +336,8 @@ int main(int argc, char** argv) {
readNext = true; readNext = true;
} }
} while ((moreFollows == true) || (readNext == true)); }
while ((moreFollows == true) || (readNext == true));
} }
} }
else else
@ -363,14 +366,12 @@ int main(int argc, char** argv) {
} }
} }
if (error != MMS_ERROR_NONE) { if (error != MMS_ERROR_NONE) {
printf("Reading variable failed: (ERROR %i)\n", error); printf("Reading variable failed: (ERROR %i)\n", error);
} }
else { else {
printf("Read SUCCESS\n"); printf("Read SUCCESS\n");
if (result != NULL) { if (result != NULL) {
char outbuf[1024]; char outbuf[1024];

Loading…
Cancel
Save