xfsdump: fix memory leak
PATCH 1/1 xfsdump: fix memory leak
Need free tmphdr and newnode before return,
otherwise it will cause memory leak.
Signed-off-by zhanchengbin <[email protected]>
--- common/drive_simple.c | 1 + invutil/list.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)
common/drive_simple.c +1 -0
@@ -456,6 +456,7 @@ do_begin_read(drive_t *drivep)/* can only read one media file */ if (contextp->dc_fmarkcnt >0 ) { +free (tmphdr);return DRIVE_ERROR_EOM ; }
invutil/list.c +3 -1
@@ -52,8 +52,10 @@ node_create(int hidden, int expanded, int level, int deleted, int file_idx, charreturn NULL ; newdata =malloc (sizeof (*newdata)); -if (newdata ==NULL ) +if (newdata ==NULL ) { +free (newnode);return NULL ; + } newdata->hidden = hidden; newdata->expanded = expanded;
Signature · 1 line
2.33.0