PVS V774: use after free

Change-Id: I96267456623389e66f003bef94246c7d58a2c23d
Reviewed-on: https://review.haiku-os.org/c/1626
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Adrien Destugues 2019-07-17 21:03:29 +02:00 committed by waddlesplash
parent a216132469
commit 1602e35c4c
2 changed files with 3 additions and 3 deletions

View File

@ -4287,10 +4287,10 @@ static BOOL mkntfs_create_root_structures(void)
1); 1);
if ((u32)(1 << -bs->clusters_per_mft_record) != if ((u32)(1 << -bs->clusters_per_mft_record) !=
g_vol->mft_record_size) { g_vol->mft_record_size) {
free(bs);
ntfs_log_error("BUG: calculated clusters_per_mft_record" ntfs_log_error("BUG: calculated clusters_per_mft_record"
" is wrong (= 0x%x)\n", " is wrong (= 0x%x)\n",
bs->clusters_per_mft_record); bs->clusters_per_mft_record);
free(bs);
return FALSE; return FALSE;
} }
} }
@ -4304,11 +4304,11 @@ static BOOL mkntfs_create_root_structures(void)
bs->clusters_per_index_record = -g_vol->indx_record_size_bits; bs->clusters_per_index_record = -g_vol->indx_record_size_bits;
if ((1 << -bs->clusters_per_index_record) != if ((1 << -bs->clusters_per_index_record) !=
(s32)g_vol->indx_record_size) { (s32)g_vol->indx_record_size) {
free(bs);
ntfs_log_error("BUG: calculated " ntfs_log_error("BUG: calculated "
"clusters_per_index_record is wrong " "clusters_per_index_record is wrong "
"(= 0x%x)\n", "(= 0x%x)\n",
bs->clusters_per_index_record); bs->clusters_per_index_record);
free(bs);
return FALSE; return FALSE;
} }
} }

View File

@ -1256,7 +1256,6 @@ RemoteView::_DrawThread()
offscreen->DrawString(string, offsets, count); offscreen->DrawString(string, offsets, count);
free(string);
reply.Start(RP_DRAW_STRING_RESULT); reply.Start(RP_DRAW_STRING_RESULT);
reply.Add(token); reply.Add(token);
reply.Add(offscreen->PenLocation()); reply.Add(offscreen->PenLocation());
@ -1268,6 +1267,7 @@ RemoteView::_DrawThread()
BRect boxes[count]; BRect boxes[count];
font.GetBoundingBoxesAsGlyphs(string, count, B_SCREEN_METRIC, font.GetBoundingBoxesAsGlyphs(string, count, B_SCREEN_METRIC,
boxes); boxes);
free(string);
font_height height; font_height height;
offscreen->GetFontHeight(&height); offscreen->GetFontHeight(&height);