Re: php7.0: FTBFS on hurd-i386 (for review)
Hello,
Svante Signell, on Thu 31 Mar 2016 10:11:35 +0200, wrote:
> + len = strlen(ZONEINFO_PREFIX) + 9 + 1;
> + zone_tab = malloc(len);
> + strncpy(zone_tab, ZONEINFO_PREFIX "/zone.tab", len);
>
> fp = fopen(zone_tab, "r");
> if (!fp) {
> + free(zone_tab);
> return NULL;
> }
>
> + free(zone_tab);
You can call free() right after fopen, instead of adding the free call
in both paths.
> + len = strlen(ZONEINFO_PREFIX) + 1 + strlen(c_tzname) + 1;
> + fname = malloc(len);
> + snprintf(fname, len, ZONEINFO_PREFIX "/%s", c_tzname);
> +
> fd = open(fname, O_RDONLY);
> if (fd == -1) {
> + free(fname);
> return NULL;
> } else if (fstat(fd, &st) != 0 || !is_valid_tzfile(&st)) {
> + free(fname);
> close(fd);
> return NULL;
> }
>
> + free(fname);
ditto.
Appart from that, it looked fine to me.
Samuel
Reply to: