Đoàn Trần Công Danh [off-list ref] writes:
On 2021-08-05 13:10:51+0530, Atharva Raykar [off-list ref] wrote:
quoted
[...]
+ add_data.sm_path = xstrdup(argv[1]);
add_data.sm_path is allocated in this block (regardless of legs).
quoted
[...]
+ if ((exit_code = pipe_command(&cp, NULL, 0, NULL, 0, &sb, 0))) {
+ strbuf_complete_line(&sb);
+ fputs(sb.buf, stderr);
+ return exit_code;
But, we don't free it when return from here.
quoted
[...]
+
+ if (add_submodule(&add_data))
+ return 1;
And here.
quoted
+ configure_added_submodule(&add_data);
+ free(add_data.sm_path);
However, it will be free()-d here, is it intended?
Yeah I meant to have it free()'d wherever possible, although I suppose
it isn't strictly necessary since we exit.
I think we may use UNLEAK above (for now) because we will exit process
after this function.
However, I anticipated we may need to do more stuffs after this
function in the future.
Right. So it's better I ensure that it's freed properly everywhere.
quoted
[...]
--
2.32.0