File tree Expand file tree Collapse file tree 2 files changed +2
-4
lines changed Expand file tree Collapse file tree 2 files changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -34,15 +34,15 @@ Content-Type: text/html; charset=UTF-8
3434DART_EXPORT void http_get (const char * uri, void (*onResponse)(const char *)) {
3535 std::thread ([onResponse]() {
3636 std::this_thread::sleep_for (std::chrono::seconds (3 ));
37- onResponse (strdup ( kExampleResponse ) );
37+ onResponse (kExampleResponse );
3838 }).detach ();
3939}
4040
4141DART_EXPORT void http_serve (void (*onRequest)(const char *)) {
4242 std::thread ([onRequest]() {
4343 while (true ) {
4444 std::this_thread::sleep_for (std::chrono::seconds (1 ));
45- onRequest (strdup ( kExampleRequest ) );
45+ onRequest (kExampleRequest );
4646 }
4747 }).detach ();
4848}
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ Future<String> httpGet(String uri) async {
1717 final completer = Completer <String >();
1818 void onResponse (Pointer <Utf8 > responsePointer) {
1919 completer.complete (responsePointer.toDartString ());
20- calloc.free (responsePointer);
2120 }
2221
2322 final callback = NativeCallable <HttpCallback >.listener (onResponse);
@@ -44,7 +43,6 @@ void httpServe(void Function(String) onRequest) {
4443 // Create the NativeCallable.listener.
4544 void onNativeRequest (Pointer <Utf8 > requestPointer) {
4645 onRequest (requestPointer.toDartString ());
47- calloc.free (requestPointer);
4846 }
4947
5048 final callback = NativeCallable <HttpCallback >.listener (onNativeRequest);
You can’t perform that action at this time.
0 commit comments