)
{
STRING home= getenv(home_env_var_name);
- int home_name_len= strlen(home);
+ int home_name_len = 0;
int i= 0;
if (home != NULL)
{
char home_relative[MAXPATHLEN];
+ home_name_len = strlen(home);
*home_relative = 0;
util_cvt_path_to_relative(ugly_dir, home, home_relative, MAXPATHLEN);
catgets(Dtb_project_catd, 10, 1, "Project Organizer"));
strcat(new_title, " - ");
strcat(new_title, proj_win_title);
+ util_free(proj_win_title);
XtVaSetValues(XtParent(AB_proj_window), XmNtitle, new_title, NULL);
catgets(Dtb_project_catd, 10, 5, "Application Builder"));
strcat(new_title, " - ");
strcat(new_title, proj_win_title);
+ util_free(proj_win_title);
if (SaveNeeded)
{
/*
* Return if no selected nodes
*/
- if (num_selected == 0)
+ if (num_selected == 0) {
+ util_free(selected_nodes);
return;
+ }
new_sel.list = (ABObj *)util_malloc(num_selected * sizeof(ABObj));
new_sel.count = 0;
/*
* Return if no selected nodes
*/
- if (num_selected == 0)
+ if (num_selected == 0) {
+ util_free(selected_nodes);
return;
+ }
for (i=0; i < num_selected; ++i)
{
/*
* Return if no selected nodes
*/
- if (num_selected == 0)
+ if (num_selected == 0) {
+ util_free(selected_nodes);
return;
+ }
for (i=0; i < num_selected; ++i)
{
/*
* Return if no collapsed nodes
*/
- if (num_collapsed == 0)
+ if (num_collapsed == 0) {
+ free(collapsed_nodes);
return;
+ }
for (i=0; i < num_collapsed; ++i)
{
strlist_add_str(doomedFiles, fileName, NULL);
if (stat(fileName, &doomedFileInfo) != 0)
{
+ util_free(doomedFiles);
return ERR_OPEN;
}
dir = opendir(".");
if (dir == NULL)
{
+ util_free(doomedFiles);
return ERR_INTERNAL;
}
/*
* Return if no selected nodes
*/
- if (num_selected == 0)
+ if (num_selected == 0) {
+ free(selected_nodes);
return;
+ }
/*
* For each object enclosed in rubber band rectangle
vwr_get_cond(v->current_tree, &selected_nodes,
&num_selected, select_fn);
- if (num_selected == 0)
+ if (num_selected == 0) {
+ free(selected_nodes);
return;
+ }
obj = (AB_OBJ *)selected_nodes[0]->obj_data;
/*
* Free up node list if it contained anything
*/
- if (selected_nodes)
- free((char *)selected_nodes);
+ free(selected_nodes);
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
*/
vwr_get_cond(v->current_tree, &selected_nodes,
&num_selected, select_fn);
- if (num_selected == 0)
+ if (num_selected == 0) {
+ free(selected_nodes);
return;
+ }
obj = (AB_OBJ *)selected_nodes[0]->obj_data;
projP_show_save_as_bil_chooser(AB_toplevel, obj);
- if (selected_nodes)
- free((char *)selected_nodes);
+ free((char *)selected_nodes);
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
vwr_get_cond(v->current_tree, &selected_nodes,
&num_selected, select_fn);
- if (num_selected == 0)
+ if (num_selected == 0) {
+ free(selected_nodes);
return;
+ }
for (i = 0; i < num_selected; ++i)
{
vwr_get_cond(v->current_tree, &selected_nodes,
&num_selected, select_fn);
- if (num_selected == 0)
+ if (num_selected == 0) {
+ free(selected_nodes);
return;
+ }
obj = (AB_OBJ *)selected_nodes[0]->obj_data;
proj_show_export_bil_chooser(AB_proj_window, obj);
+ free(selected_nodes);
+
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
{
util_print_error(rc, new_filename);
obj_set_name(project, old_name);
- if (old_name != NULL) util_free(old_name);
- if (old_file != NULL) util_free(old_file);
- if (old_proj_dir != NULL) util_free(old_proj_dir);
+ util_free(old_name);
+ util_free(old_file);
+ util_free(old_proj_dir);
return rc;
}
obj_set_file(project, new_filename);
*/
vwr_get_cond(proj_vwr->current_tree, &selected_nodes,
&num_selected, select_fn);
+ free(selected_nodes); /* Unused variable */
switch (chooser_type)
{
abmfP_pattern_xmstr_var_has_value(genCodeInfo) = TRUE;
}
}
+
+ return 0;
}
static int
static char new_name[MAX_NAME_SIZE];
char *p;
- strcpy(new_name, item_name);
+ snprintf(new_name, sizeof(new_name), "%s", item_name);
p = (char *) strrchr(new_name, '_');
if (p != NULL)
*p = '\0';
}
if (widgetParent != NULL)
{
- strcpy(parentName,
+ snprintf(parentName, sizeof(parentName), "%s",
abmfP_get_c_name(genCodeInfo, widgetParent));
parentFound = TRUE;
}
}
fieldName = abmfP_get_c_field_name(obj);
- strcpy(name, structName);
- strcat(name, ".");
if (substructName != NULL)
{
- strcat(name, substructName);
- strcat(name, ".");
+ snprintf(name, sizeof(name), "%s.%s.%s", structName, substructName, fieldName);
+ } else {
+ snprintf(name, sizeof(name), "%s.%s", structName, fieldName);
}
- strcat(name, fieldName);
return name;
}
}
fieldName = abmfP_get_c_field_name(obj);
- strcpy(name, abmfP_instance_ptr_var_name);
- strcat(name, "->");
if (substructName != NULL)
{
- strcat(name, substructName);
- strcat(name, ".");
+ snprintf(name, sizeof(name), "%s->%s.%s",
+ abmfP_instance_ptr_var_name,
+ substructName, fieldName);
+ } else {
+ snprintf(name, sizeof(name), "%s->%s",
+ abmfP_instance_ptr_var_name,
+ fieldName);
}
- strcat(name, fieldName);
return name;
}
abmfP_get_c_substruct_ptr_type_name(ABObj obj)
{
static char ptrTypeName[MAX_NAME_SIZE];
+ char ptrTypeNameTmp[sizeof(ptrTypeName)];
STRING varName = NULL;
ABObj module = NULL;
return NULL;
else
{
- strcpy(ptrTypeName, typePrefixString);
- strcat(ptrTypeName,
- abmfP_capitalize_first_char(obj_get_name(module)));
- strcat(ptrTypeName, abmfP_capitalize_first_char(varName));
- strcat(ptrTypeName, "Items");
+ /* Warning: Due to abmfP_capitalize_first_char() returning a pointer
+ * to static data this cannot be one snprintf() */
+ snprintf(ptrTypeNameTmp, sizeof(ptrTypeNameTmp), "%s%s",
+ typePrefixString, abmfP_capitalize_first_char(obj_get_name(module)));
+ snprintf(ptrTypeName, sizeof(ptrTypeName), "%s%sItems",
+ ptrTypeNameTmp, abmfP_capitalize_first_char(varName));
cvt_ident_to_type(ptrTypeName);
}
}
{
char newObjName[1024];
- *newObjName = 0;
if (compRootName != NULL)
{
- strcat(newObjName, compRootName);
+ snprintf(newObjName, sizeof(newObjName), "%s_%s", compRootName, ext);
+ } else {
+ snprintf(newObjName, sizeof(newObjName), "_%s", ext);
}
- strcat(newObjName, "_");
- strcat(newObjName, ext);
util_dprintf(2, "changing field name %s -> %s\n",
util_strsafe(obj_get_name(compRoot)), newObjName);
ABObj action = NULL;
ABObj fromObj = NULL;
AB_TRAVERSAL trav;
- StringList callback_funcs = strlist_create();
+ StringList callback_funcs = NULL;
if (!obj_is_message(msg_obj))
return NULL;
+ callback_funcs = strlist_create();
+
module = obj_get_module(msg_obj);
for (trav_open(&trav, module, AB_TRAV_ACTIONS);
(action = trav_next(&trav)) != NULL; )
first = 0;
if (strcpy(bil_list, file) == NULL)
{
- if (bil_list) util_free(bil_list);
+ util_free(bil_list);
return NULL;
}
}
if ( (new_objs == NULL)
|| (user_datas_valid && (new_user_datas == NULL)) )
{
+ free(new_objs);
+ free(new_user_datas);
return_value = ERR_NO_MEMORY;
goto epilogue;
}
if (ok)
{
obj_str_ptr_name = istr_string(obj->name);
- sprintf((STRING)obj_name, "(ABObj %#lx", (unsigned long) obj);
if (obj_str_ptr_name != NULL)
{
- strcat((STRING)obj_name, " = ");
- strcat((STRING)obj_name, obj_str_ptr_name);
+ snprintf((STRING)obj_name, sizeof(obj_name),
+ "(ABObj %#lx = %s)", (unsigned long) obj, obj_str_ptr_name);
+ } else {
+ snprintf((STRING)obj_name, sizeof(obj_name),
+ "(ABObj %#lx)", (unsigned long) obj);
}
- strcat((STRING)obj_name, ")");
if (!ok)
{
field_err("name");
/* don't call travP_close(trav) - keep the traversal open */
if (iRet < 0)
{
+ util_free(objArray);
return iRet;
}
fprintf(stderr, "%s",
catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 2,
"ISTR: error in allocating space for string\n") );
+ free(new_bucket);
return NULL;
}
new_bucket->values[0] = freelist[freecount-1];
fprintf(stderr, "%s",
catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 2,
"ISTR: error in allocating space for string\n") );
+ free(new_bucket);
return NULL;
}
new_bucket->values[0] = freelist[freecount-1];
if ((new_strings == NULL) || (new_user_datas == NULL))
{
return_value = -1;
+ free(new_strings);
+ free(new_user_datas);
goto epilogue;
}
else
len = strlen(name) - (AB_EXT_LENGTH + 1);
strncpy(objname, name, len);
objname[len] = '\0';
+ free(name);
}
else
{