if (strlen(argv[i]) != 2) {
printf("Invalid value byte: %s\n",
argv[i]);
- free(value);
- return;
+ goto done;
}
value[i-1] = strtol(argv[i], &endptr, 16);
|| errno == ERANGE) {
printf("Invalid value byte: %s\n",
argv[i]);
- free(value);
- return;
+ goto done;
}
}
}
false, value, length)) {
printf("Failed to initiate write without response "
"procedure\n");
- return;
+ goto done;
}
printf("Write command sent\n");
- return;
+ goto done;
}
if (!bt_gatt_client_write_value(cli->gatt, handle, value, length,
NULL, NULL))
printf("Failed to initiate write procedure\n");
+done:
free(value);
}