mirror of
https://github.com/MariaDB/server.git
synced 2025-08-09 22:24:09 +03:00
innodbchecksum: add fclose and handle errors
This commit is contained in:
@@ -694,14 +694,14 @@ int main(int argc, char **argv)
|
|||||||
if (*filename == '\0')
|
if (*filename == '\0')
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error; File name missing\n");
|
fprintf(stderr, "Error; File name missing\n");
|
||||||
goto error;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stat the file to get size and page count */
|
/* stat the file to get size and page count */
|
||||||
if (stat(filename, &st))
|
if (stat(filename, &st))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error; %s cannot be found\n", filename);
|
fprintf(stderr, "Error; %s cannot be found\n", filename);
|
||||||
goto error;
|
goto error_out;
|
||||||
}
|
}
|
||||||
size= st.st_size;
|
size= st.st_size;
|
||||||
|
|
||||||
@@ -711,7 +711,7 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "Error; %s cannot be opened", filename);
|
fprintf(stderr, "Error; %s cannot be opened", filename);
|
||||||
perror(" ");
|
perror(" ");
|
||||||
goto error;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
big_buf = (unsigned char *)malloc(2 * UNIV_PAGE_SIZE_MAX);
|
big_buf = (unsigned char *)malloc(2 * UNIV_PAGE_SIZE_MAX);
|
||||||
@@ -719,7 +719,7 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "Error; failed to allocate memory\n");
|
fprintf(stderr, "Error; failed to allocate memory\n");
|
||||||
perror("");
|
perror("");
|
||||||
goto error;
|
goto error_f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure the page is aligned */
|
/* Make sure the page is aligned */
|
||||||
@@ -731,7 +731,7 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "Error; failed to allocate memory\n");
|
fprintf(stderr, "Error; failed to allocate memory\n");
|
||||||
perror("");
|
perror("");
|
||||||
return 1;
|
goto error_big_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure the page is aligned */
|
/* Make sure the page is aligned */
|
||||||
@@ -983,12 +983,17 @@ ok:
|
|||||||
print_stats();
|
print_stats();
|
||||||
free(big_xdes);
|
free(big_xdes);
|
||||||
free(big_buf);
|
free(big_buf);
|
||||||
|
fclose(f);
|
||||||
my_end(0);
|
my_end(0);
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
free(big_xdes);
|
free(big_xdes);
|
||||||
|
error_big_buf:
|
||||||
free(big_buf);
|
free(big_buf);
|
||||||
|
error_f:
|
||||||
|
fclose(f);
|
||||||
|
error_out:
|
||||||
my_end(0);
|
my_end(0);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user