free the memory that allocated by malloc and strdup.

Signed-off-by: Wei,Jiangang <weijg.f...@cn.fujitsu.com>
---
 testcases/kernel/fs/doio/doio.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/testcases/kernel/fs/doio/doio.c b/testcases/kernel/fs/doio/doio.c
index 4b0dec5..f5b9d66 100644
--- a/testcases/kernel/fs/doio/doio.c
+++ b/testcases/kernel/fs/doio/doio.c
@@ -1360,6 +1360,7 @@ char *format_rw(struct io_req *ioreq, int fd, void 
*buffer, int signo,
                break;
 
        }
+       free(aio_strat);
 
        return errbuf;
 }
@@ -2071,6 +2072,8 @@ char *format_listio(struct io_req *ioreq, int lcmd, 
struct listreq *list,
                    sprintf(cp, "          io completion strategy is %s\n",
                            aio_strat);
        }
+       free(aio_strat);
+
        return errbuf;
 }
 #endif /* CRAY */
@@ -2558,6 +2561,7 @@ struct status *sy_listio(struct io_req *req, struct 
syscall_info *sysc, int fd,
        }
        status->aioid = malloc((nents + 1) * sizeof(int));
        if (status->aioid == NULL) {
+               free(status);
                doio_fprintf(stderr, "malloc failed, %s/%d\n",
                             __FILE__, __LINE__);
                return NULL;
@@ -2567,6 +2571,8 @@ struct status *sy_listio(struct io_req *req, struct 
syscall_info *sysc, int fd,
 
        lio_req = malloc(nents * sizeof(struct listreq));
        if (lio_req == NULL) {
+               free(status->aioid);
+               free(status);
                doio_fprintf(stderr, "malloc failed, %s/%d\n",
                             __FILE__, __LINE__);
                return NULL;
-- 
1.9.3


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to