Skip to content

Commit a21bc8e

Browse files
committed
m
1 parent 7157850 commit a21bc8e

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

‎test-server/cpp-v2-server/main.cpp‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,8 @@ MHD_Result request_handler(void *cls, struct MHD_Connection *connection,
238238
std::string url_str(url);
239239

240240
if (is_push && url_str == "/client") {
241-
std::string *body = static_cast<std::string *>(*con_cls);
242-
auto foo = handle_create_client(connection, *body);
243-
delete body;
244-
return foo;
241+
std::unique_ptr<std::string> body(static_cast<std::string*>(*con_cls));
242+
return handle_create_client(connection, *body);
245243
}
246244

247245
if (url_str.find("/object/") == 0) {
@@ -256,12 +254,9 @@ MHD_Result request_handler(void *cls, struct MHD_Connection *connection,
256254
if (method_str == "GET") {
257255
return handle_get_object(connection, bucket, key, client_id, metadata);
258256
} else if (method_str == "PUT") {
259-
std::string *body = static_cast<std::string *>(*con_cls);
257+
std::unique_ptr<std::string> body(static_cast<std::string*>(*con_cls));
260258
*upload_data_size = 0;
261-
auto foo = handle_put_object(connection, bucket, key, client_id, *body,
262-
metadata);
263-
delete body;
264-
return foo;
259+
return handle_put_object(connection, bucket, key, client_id, *body, metadata);
265260
}
266261
}
267262
}

0 commit comments

Comments
 (0)