Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
fad12d97
Commit
fad12d97
authored
Aug 10, 2009
by
Henrik (Grubba) Grubbström
Browse files
Options
Downloads
Patches
Plain Diff
Fixed several memory leaks in decode_header().
Rev: src/modules/Image/encodings/wbf.c:1.19
parent
060a2fc8
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/modules/Image/encodings/wbf.c
+17
-14
17 additions, 14 deletions
src/modules/Image/encodings/wbf.c
with
17 additions
and
14 deletions
src/modules/Image/encodings/wbf.c
+
17
−
14
View file @
fad12d97
...
...
@@ -2,7 +2,7 @@
|| This file is part of Pike. For copyright information see COPYRIGHT.
|| Pike is distributed under GPL, LGPL and MPL. See the file COPYING
|| for more information.
|| $Id: wbf.c,v 1.1
8
200
5
/0
1/23 13:30:04 nilsson
Exp $
|| $Id: wbf.c,v 1.1
9
200
9
/0
8/10 14:23:25 grubba
Exp $
*/
#include
"global.h"
...
...
@@ -108,12 +108,25 @@ static void push_ext_header( struct ext_header *eh )
f_aggregate_mapping
(
4
);
}
static
void
free_wbf_header_contents
(
struct
wbf_header
*
wh
)
{
while
(
wh
->
first_ext_header
)
{
struct
ext_header
*
eh
=
wh
->
first_ext_header
;
wh
->
first_ext_header
=
eh
->
next
;
free
(
eh
);
}
}
static
struct
wbf_header
decode_header
(
struct
buffer
*
data
)
{
struct
wbf_header
res
;
ONERROR
err
;
MEMSET
(
&
res
,
0
,
sizeof
(
res
)
);
res
.
type
=
wbf_read_int
(
data
);
res
.
fix_header_field
=
read_uchar
(
data
);
SET_ONERROR
(
err
,
free_wbf_header_contents
,
&
res
);
if
(
res
.
fix_header_field
&
0x80
)
{
switch
(
(
res
.
fix_header_field
>>
5
)
&
0x3
)
...
...
@@ -133,32 +146,22 @@ static struct wbf_header decode_header( struct buffer *data )
q
=
read_uchar
(
data
);
eh
=
xalloc
(
sizeof
(
struct
ext_header
)
);
MEMSET
(
eh
,
0
,
sizeof
(
struct
ext_header
)
);
eh
->
next
=
res
.
first_ext_header
;
res
.
first_ext_header
=
eh
;
eh
->
name_len
=
((
q
>>
4
)
&
0x7
)
+
1
;
eh
->
value_len
=
(
q
&
0xf
)
+
1
;
read_string
(
data
,
eh
->
name_len
,
eh
->
name
);
read_string
(
data
,
eh
->
value_len
,
eh
->
value
);
eh
->
next
=
res
.
first_ext_header
;
res
.
first_ext_header
=
eh
->
next
;
}
}
}
}
res
.
width
=
wbf_read_int
(
data
);
res
.
height
=
wbf_read_int
(
data
);
UNSET_ONERROR
(
err
);
return
res
;
}
static
void
free_wbf_header_contents
(
struct
wbf_header
*
wh
)
{
while
(
wh
->
first_ext_header
)
{
struct
ext_header
*
eh
=
wh
->
first_ext_header
;
wh
->
first_ext_header
=
eh
->
next
;
free
(
eh
);
}
}
static
void
low_image_f_wbf_decode_type0
(
struct
wbf_header
*
wh
,
struct
buffer
*
buff
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment