...
Code Block | ||
---|---|---|
| ||
x = (int *)malloc (number * sizeof(int));
if (x == NULL) {
/* Handle Allocation Error */
}
/* ... */
if (error_conditon == 1) {
/* Handle Error Condition*/
free(x);
}
/* ... */
free(x);
|
...
Code Block | ||
---|---|---|
| ||
if (sizeof(int) > SIZE_MAX/number) {
/* handle overflow */
}
x = (int *)malloc(number * sizeof(int));
if (x == NULL) {
/* Handle Allocation Error */
}
/* ... */
if (error_conditon == 1) {
/* Handle Error Condition*/
}
/* ... */
free(x);
|
...