mirror of
https://gitee.com/wangbin579/cetus.git
synced 2024-11-29 18:37:36 +08:00
Fix several problems revealed by static analysis
This commit is contained in:
parent
5f3a73c8f1
commit
b3501eb2c6
@ -2069,7 +2069,6 @@ network_mysqld_shard_plugin_free(chassis *chas, chassis_plugin_config *config)
|
||||
g_free(config->address);
|
||||
}
|
||||
sql_filter_vars_destroy();
|
||||
g_debug("%s: call shard_conf_destroy", G_STRLOC);
|
||||
shard_conf_destroy();
|
||||
|
||||
g_free(config);
|
||||
|
@ -623,7 +623,6 @@ release_resouces_when_exit(struct chassis_frontend_t *frontend, chassis *srv, GE
|
||||
g_debug("%s: call chassis_options_free", G_STRLOC);
|
||||
if (opts)
|
||||
chassis_options_free(opts);
|
||||
g_debug("%s: call g_hash_table_destroy", G_STRLOC);
|
||||
g_debug("%s: call chassis_log_free", G_STRLOC);
|
||||
chassis_log_free(log);
|
||||
tc_log_end();
|
||||
|
@ -455,9 +455,15 @@ shard_conf_destroy(void)
|
||||
if (shard_conf_vdbs) {
|
||||
g_list_free_full(shard_conf_vdbs, (GDestroyNotify) sharding_vdb_free);
|
||||
}
|
||||
g_hash_table_destroy(shard_conf_tables);
|
||||
g_list_free_full(shard_conf_single_tables, (GDestroyNotify) single_table_free);
|
||||
g_list_free_full(shard_conf_all_groups, g_string_true_free);
|
||||
if (shard_conf_tables) {
|
||||
g_hash_table_destroy(shard_conf_tables);
|
||||
}
|
||||
if (shard_conf_single_tables) {
|
||||
g_list_free_full(shard_conf_single_tables, (GDestroyNotify) single_table_free);
|
||||
}
|
||||
if (shard_conf_all_groups) {
|
||||
g_list_free_full(shard_conf_all_groups, g_string_true_free);
|
||||
}
|
||||
}
|
||||
|
||||
static GHashTable *load_shard_from_json(gchar *json_str);
|
||||
|
@ -2785,6 +2785,7 @@ void Parse(struct lemon *gp)
|
||||
filebuf = (char *)malloc( filesize+1);
|
||||
if (filesize>100000000 || filebuf == 0) {
|
||||
ErrorMsg(ps.filename,0,"Input file too large.");
|
||||
free(filebuf);
|
||||
gp->errorcnt++;
|
||||
fclose(fp);
|
||||
return;
|
||||
@ -3278,8 +3279,8 @@ PRIVATE char *pathsearch(char *argv0, char *name, int modemask)
|
||||
if (pathlist == 0) pathlist = ".:/bin:/usr/bin";
|
||||
pathbuf = (char *) malloc( lemonStrlen(pathlist) + 1);
|
||||
path = (char *)malloc( lemonStrlen(pathlist)+lemonStrlen(name)+2);
|
||||
pathbufptr = pathbuf;
|
||||
if ((pathbuf != 0) && (path!=0) ) {
|
||||
pathbufptr = pathbuf;
|
||||
lemon_strcpy(pathbuf, pathlist);
|
||||
while(*pathbuf) {
|
||||
cp = strchr(pathbuf,':');
|
||||
@ -3292,7 +3293,10 @@ PRIVATE char *pathsearch(char *argv0, char *name, int modemask)
|
||||
else pathbuf = &cp[1];
|
||||
if (access(path,modemask) == 0) break;
|
||||
}
|
||||
free(pathbufptr);
|
||||
}
|
||||
|
||||
if (pathbufptr) {
|
||||
free(pathbufptr);
|
||||
}
|
||||
}
|
||||
return path;
|
||||
@ -3356,7 +3360,7 @@ PRIVATE FILE *tplt_open(struct lemon *lemp)
|
||||
static char templatename[] = "lempar.c";
|
||||
char buf[1000];
|
||||
FILE *in;
|
||||
char *tpltname;
|
||||
char *tpltname, *tmp = NULL;
|
||||
char *cp;
|
||||
|
||||
/* first, see if user specified a template filename on the command line. */
|
||||
@ -3388,7 +3392,8 @@ PRIVATE FILE *tplt_open(struct lemon *lemp)
|
||||
} else if (access(templatename,004) == 0) {
|
||||
tpltname = templatename;
|
||||
} else{
|
||||
tpltname = pathsearch(lemp->argv0,templatename,0);
|
||||
tmp = pathsearch(lemp->argv0,templatename,0);
|
||||
tpltname = tmp;
|
||||
}
|
||||
if (tpltname == 0) {
|
||||
fprintf(stderr,"Can't find the parser driver template file \"%s\".\n",
|
||||
@ -3397,6 +3402,9 @@ PRIVATE FILE *tplt_open(struct lemon *lemp)
|
||||
return 0;
|
||||
}
|
||||
in = fopen(tpltname,"rb");
|
||||
if (tmp) {
|
||||
free(tmp);
|
||||
}
|
||||
if (in == 0) {
|
||||
fprintf(stderr,"Can't open the template file \"%s\".\n",templatename);
|
||||
lemp->errorcnt++;
|
||||
@ -4492,6 +4500,7 @@ void ReportTable(
|
||||
/* Append any addition code the user desires */
|
||||
tplt_print(out,lemp,lemp->extracode,&lineno);
|
||||
|
||||
free(pActtab);
|
||||
fclose(in);
|
||||
fclose(out);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user