hsa: fix http client path formating for fopen 26/43226/2
authorMatus Fabian <[email protected]>
Wed, 18 Jun 2025 19:34:01 +0000 (15:34 -0400)
committerFlorin Coras <[email protected]>
Wed, 18 Jun 2025 23:50:07 +0000 (23:50 +0000)
format full path into variable, null terminate and free it after use
in hc_session_connected_callback

Type: fix

Change-Id: I3ed64dd247bf5ac9af8fa65517b6308a98205fd4
Signed-off-by: Matus Fabian <[email protected]>
src/plugins/hs_apps/http_client.c

index 6e52100..fbb2b1c 100644 (file)
@@ -226,6 +226,7 @@ hc_session_connected_callback (u32 app_index, u32 hc_session_index,
   hc_worker_t *wrk;
   hc_session_t *hc_session;
   hc_http_header_t *header;
+  u8 *f = 0;
 
   if (err)
     {
@@ -267,8 +268,9 @@ hc_session_connected_callback (u32 app_index, u32 hc_session_index,
     }
   if (hcm->filename)
     {
-      hc_session->file_ptr =
-       fopen ((char *) format (0, "/tmp/%v", hcm->filename), "w");
+      f = format (0, "/tmp/%s%c", hcm->filename, 0);
+      hc_session->file_ptr = fopen ((char *) f, "w");
+      vec_free (f);
       if (hc_session->file_ptr == NULL)
        {
          vlib_process_signal_event_mt (wrk->vlib_main, hcm->cli_node_index,