On Wed, Oct 3, 2012 at 11:01 PM, Tobias Burnus <bur...@net-b.de> wrote:
> Found using http://scan5.coverity.com/
>
> Build on x86-64-gnu-linux with C/C++/Fortran. I will now do an all-language
> build/regtest.
> OK when it passes?
>
> (Note to the save_string call: I reduced it by 2: The "+1" in the call makes
> it long (out of bounds) and the "+1" in temp_filename_length is not needed
> (but also doesn't harm) as "tmp" is null terminated and save_string adds
> another '\0' after copying "len" bytes.)

-         prefix = concat (target_sysroot_suffix, prefix, NULL);
-      prefix = concat (sysroot_no_trailing_dir_separator, prefix, NULL);
+       {
+         char *tmp;
+         tmp = concat (target_sysroot_suffix, prefix, NULL);
+         prefix = concat (sysroot_no_trailing_dir_separator, tmp, NULL);
+         free (tmp);
+       }

    prefix = concat (sysroot_no_trailing_dir_separator,
target_sysroot_suffix, prefix, NULL);

should be equivalent and easier to read, no?

+      else
+       prefix = concat (sysroot_no_trailing_dir_separator, prefix, NULL);
+

btw, we're not careing too much about memleaks in the driver ...

Otherwise the patch looks ok with the above change.

Thanks,
Richard.

> Tobias

Reply via email to