Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
4d8d02a1
Commit
4d8d02a1
authored
Jan 30, 2019
by
Marcus Nordenberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
profinet configurator: fix some memory leaks and other memory issues
parent
ed36bc73
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
128 additions
and
13 deletions
+128
-13
profibus/lib/cow/src/cow_pn_gsdml.cpp
profibus/lib/cow/src/cow_pn_gsdml.cpp
+85
-1
profibus/lib/cow/src/cow_pn_gsdml_attr.cpp
profibus/lib/cow/src/cow_pn_gsdml_attr.cpp
+4
-1
profibus/lib/cow/src/cow_pn_gsdml_attrnav.cpp
profibus/lib/cow/src/cow_pn_gsdml_attrnav.cpp
+13
-5
profibus/lib/rt/src/rt_pn_gsdml_data.cpp
profibus/lib/rt/src/rt_pn_gsdml_data.cpp
+13
-4
profibus/lib/rt/src/rt_pn_gsdml_data.h
profibus/lib/rt/src/rt_pn_gsdml_data.h
+7
-2
profibus/lib/wb/gtk/wb_c_pndevice_gtk.cpp
profibus/lib/wb/gtk/wb_c_pndevice_gtk.cpp
+6
-0
No files found.
profibus/lib/cow/src/cow_pn_gsdml.cpp
View file @
4d8d02a1
This diff is collapsed.
Click to expand it.
profibus/lib/cow/src/cow_pn_gsdml_attr.cpp
View file @
4d8d02a1
...
...
@@ -282,7 +282,10 @@ void GsdmlAttr::activate_cmd_ca()
}
}
GsdmlAttr
::~
GsdmlAttr
()
{}
GsdmlAttr
::~
GsdmlAttr
()
{
if
(
wow
)
delete
wow
;
}
GsdmlAttr
::
GsdmlAttr
(
void
*
a_parent_ctx
,
void
*
a_object
,
pn_gsdml
*
a_gsdml
,
int
a_edit_mode
,
const
char
*
a_data_filename
)
...
...
profibus/lib/cow/src/cow_pn_gsdml_attrnav.cpp
View file @
4d8d02a1
...
...
@@ -1471,13 +1471,21 @@ int GsdmlAttrNav::save(const char* filename)
(
char
*
)
gsdml
->
ApplicationProcess
->
ChannelDiagList
->
ChannelDiagItem
[
i
]
->
Body
.
Name
.
p
,
sizeof
(
cd
->
name
));
//Make sure we null terminate these in case our buffer is too small to accomodate the entire diag name string.
cd
->
name
[
sizeof
(
cd
->
name
)
-
1
]
=
'\0'
;
if
(
gsdml
->
ApplicationProcess
->
ChannelDiagList
->
ChannelDiagItem
[
i
]
->
Body
.
Help
.
p
)
strncpy
(
cd
->
help
,
(
char
*
)
gsdml
->
ApplicationProcess
->
ChannelDiagList
->
ChannelDiagItem
[
i
]
->
Body
.
Help
.
p
,
sizeof
(
cd
->
help
));
{
strncpy
(
cd
->
help
,
(
char
*
)
gsdml
->
ApplicationProcess
->
ChannelDiagList
->
ChannelDiagItem
[
i
]
->
Body
.
Help
.
p
,
sizeof
(
cd
->
help
));
//Make sure we null terminate these in case our buffer is too small to accomodate the entire help string.
cd
->
help
[
sizeof
(
cd
->
help
)
-
1
]
=
'\0'
;
}
dev_data
.
channel_diag
.
push_back
(
cd
);
}
}
...
...
profibus/lib/rt/src/rt_pn_gsdml_data.cpp
View file @
4d8d02a1
...
...
@@ -62,8 +62,8 @@ GsdmlSlotData* GsdmlDeviceData::paste_slotdata = 0;
GsdmlChannelDiag
::
GsdmlChannelDiag
()
:
error_type
(
0
)
{
strcpy
(
name
,
""
);
strcpy
(
help
,
""
);
memset
(
name
,
0
,
sizeof
(
name
)
);
memset
(
help
,
0
,
sizeof
(
help
)
);
}
int
GsdmlChannelDiag
::
print
(
std
::
ofstream
&
fp
)
...
...
@@ -89,9 +89,18 @@ GsdmlDataRecord::GsdmlDataRecord(const GsdmlDataRecord& x)
int
GsdmlDataRecord
::
print
(
std
::
ofstream
&
fp
,
bool
reverse_endianess
)
{
char
str
[
1024
];
unsigned
char
*
data
;
unsigned
char
*
data
=
(
reverse_endianess
?
this
->
data_reversed_endianess
:
this
->
data
);
// If we have allocated memory for reversed endianess we come from the pn configurator otherwise we use the data as is.
// The method SetIoDeviceData for instance reads the raw data and then recreates the pn configuration file.
if
(
data_reversed_endianess
)
{
data
=
(
reverse_endianess
?
this
->
data_reversed_endianess
:
this
->
data
);
}
else
{
data
=
this
->
data
;
}
co_xml_parser
::
data_to_ostring
(
data
,
data_length
,
str
,
sizeof
(
str
));
...
...
profibus/lib/rt/src/rt_pn_gsdml_data.h
View file @
4d8d02a1
...
...
@@ -63,6 +63,8 @@ public:
{
if
(
data
)
free
(
data
);
if
(
data_reversed_endianess
)
free
(
data_reversed_endianess
);
}
GsdmlDataRecord
(
const
GsdmlDataRecord
&
x
);
...
...
@@ -170,7 +172,7 @@ public:
GsdmlChannelDiag
();
unsigned
short
error_type
;
char
name
[
200
];
char
help
[
256
];
char
help
[
4096
];
// We need a large buffer for most of the help text in the diagnostics...
int
print
(
std
::
ofstream
&
fp
);
};
...
...
@@ -208,7 +210,10 @@ public:
static
GsdmlSlotData
*
paste_slotdata
;
std
::
vector
<
GsdmlChannelDiag
*>
channel_diag
;
~
GsdmlDeviceData
()
{
device_reset
();
}
~
GsdmlDeviceData
()
{
device_reset
();
channel_diag_reset
();
}
void
device_reset
()
{
for
(
unsigned
int
i
=
0
;
i
<
slot_data
.
size
();
i
++
)
...
...
profibus/lib/wb/gtk/wb_c_pndevice_gtk.cpp
View file @
4d8d02a1
...
...
@@ -229,7 +229,10 @@ static pwr_tStatus GetIoDeviceData(pwr_tAttrRef Object, const char* Attr,
GsdmlDeviceData
*
data
=
new
GsdmlDeviceData
();
sts
=
data
->
read
(
datafile
);
if
(
EVEN
(
sts
))
{
delete
data
;
return
sts
;
}
sts
=
data
->
get_value
(
Attr
,
Buf
,
BufSize
);
...
...
@@ -250,7 +253,10 @@ static pwr_tStatus SetIoDeviceData(pwr_tAttrRef Object, const char* Attr,
GsdmlDeviceData
*
data
=
new
GsdmlDeviceData
();
sts
=
data
->
read
(
datafile
);
if
(
EVEN
(
sts
))
{
delete
data
;
return
sts
;
}
sts
=
data
->
modify_value
(
Attr
,
Value
);
if
(
ODD
(
sts
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment