diff --git a/examples/big_upload/big_upload.c b/examples/big_upload/big_upload.c
index 563436503e797b8319a11a14a7240ff067c37298..5926aeb9449d0ebd0738cb48e58c58d4b3bb68ae 100644
--- a/examples/big_upload/big_upload.c
+++ b/examples/big_upload/big_upload.c
@@ -33,6 +33,7 @@ static void handle_upload(struct mg_connection *nc, int ev, void *p) {
                     "HTTP/1.1 500 Failed to open a file\r\n"
                     "Content-Length: 0\r\n\r\n");
           nc->flags |= MG_F_SEND_AND_CLOSE;
+          free(data);
           return;
         }
         nc->user_data = (void *) data;