فهرست منبع

【修复】示例代码内存泄露

Signed-off-by: chenyong <1521761801@qq.com>
chenyong 6 سال پیش
والد
کامیت
10ece6296d
2فایلهای تغییر یافته به همراه12 افزوده شده و 2 حذف شده
  1. 6 1
      samples/webclient_get_sample.c
  2. 6 1
      samples/webclient_post_sample.c

+ 6 - 1
samples/webclient_get_sample.c

@@ -197,7 +197,12 @@ int webclient_get_test(int argc, char **argv)
         return -RT_ERROR;
         return -RT_ERROR;
     }
     }
 
 
-    return 0;
+    if (uri)
+    {
+        web_free(uri);
+    }
+    
+    return RT_EOK;
 }
 }
 
 
 #ifdef FINSH_USING_MSH
 #ifdef FINSH_USING_MSH

+ 6 - 1
samples/webclient_post_sample.c

@@ -181,8 +181,13 @@ int webclient_post_test(int argc, char **argv)
         rt_kprintf("web_post_test -s [uri]  - webclient simplify post request test.\n");
         rt_kprintf("web_post_test -s [uri]  - webclient simplify post request test.\n");
         return -RT_ERROR;
         return -RT_ERROR;
     }
     }
+    
+    if (uri)
+    {
+        web_free(uri);
+    }
 
 
-    return 0;
+    return RT_EOK;
 }
 }