Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9b74f35

Browse files
committed
Fix resource leak pointed out by Coverity.
1 parent312efcf commit9b74f35

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎contrib/pgbench/pgbench.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,12 +1337,16 @@ parseQuery(Command *cmd, const char *raw_sql)
13371337
if (cmd->argc >=MAX_ARGS)
13381338
{
13391339
fprintf(stderr,"statement has too many arguments (maximum is %d): %s\n",MAX_ARGS-1,raw_sql);
1340+
free(name);
13401341
return false;
13411342
}
13421343

13431344
sprintf(var,"$%d",cmd->argc);
13441345
if ((p=replaceVariable(&sql,p,eaten,var))==NULL)
1346+
{
1347+
free(name);
13451348
return false;
1349+
}
13461350

13471351
cmd->argv[cmd->argc]=name;
13481352
cmd->argc++;
@@ -1504,7 +1508,10 @@ process_commands(char *buf)
15041508
caseQUERY_EXTENDED:
15051509
caseQUERY_PREPARED:
15061510
if (!parseQuery(my_commands,p))
1511+
{
1512+
free(my_commands);
15071513
returnNULL;
1514+
}
15081515
break;
15091516
default:
15101517
returnNULL;
@@ -1560,6 +1567,7 @@ process_file(char *filename)
15601567
commands=process_commands(&buf[i]);
15611568
if (commands==NULL)
15621569
{
1570+
free(my_commands);
15631571
fclose(fd);
15641572
return false;
15651573
}
@@ -1630,6 +1638,7 @@ process_builtin(char *tb)
16301638
commands=process_commands(buf);
16311639
if (commands==NULL)
16321640
{
1641+
free(my_commands);
16331642
returnNULL;
16341643
}
16351644

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp