Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
b2e68602
Commit
b2e68602
authored
Feb 09, 2003
by
Rusty Russell
Committed by
Linus Torvalds
Feb 09, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] Memory leak in drivers_net_arlan.c (1)
From: Pablo Menichini <pablo@menichini.com.ar>
parent
b929b515
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
27 deletions
+27
-27
drivers/net/arlan.c
drivers/net/arlan.c
+26
-27
drivers/net/arlan.h
drivers/net/arlan.h
+1
-0
No files found.
drivers/net/arlan.c
View file @
b2e68602
...
@@ -1188,34 +1188,31 @@ static int __init
...
@@ -1188,34 +1188,31 @@ static int __init
{
{
struct
net_device
*
dev
;
struct
net_device
*
dev
;
struct
arlan_private
*
ap
;
ARLAN_DEBUG_ENTRY
(
"arlan_allocate_device"
);
ARLAN_DEBUG_ENTRY
(
"arlan_allocate_device"
);
if
(
!
devs
)
if
(
!
devs
)
{
dev
=
init_etherdev
(
0
,
sizeof
(
struct
arlan_private
));
dev
=
init_etherdev
(
0
,
sizeof
(
struct
arlan_private
)
+
sizeof
(
struct
arlan_shmem
));
else
if
(
!
dev
)
{
{
printk
(
KERN_ERR
"ARLAN: init_etherdev failed
\n
"
);
return
0
;
}
ap
=
dev
->
priv
;
ap
->
config
=
dev
->
priv
+
sizeof
(
struct
arlan_private
);
ap
->
init_etherdev_alloc
=
1
;
}
else
{
dev
=
devs
;
dev
=
devs
;
dev
->
priv
=
kmalloc
(
sizeof
(
struct
arlan_private
),
GFP_KERNEL
);
dev
->
priv
=
kmalloc
(
sizeof
(
struct
arlan_private
)
+
sizeof
(
struct
arlan_shmem
),
GFP_KERNEL
);
};
if
(
!
dev
->
priv
)
{
printk
(
KERN_ERR
"ARLAN: kmalloc of dev->priv failed
\n
"
);
if
(
dev
==
NULL
||
dev
->
priv
==
NULL
)
return
0
;
{
}
printk
(
KERN_CRIT
"init_etherdev failed "
);
ap
=
dev
->
priv
;
return
0
;
ap
->
config
=
dev
->
priv
+
sizeof
(
struct
arlan_private
);
memset
(
ap
,
0
,
sizeof
(
*
ap
));
}
}
memset
(
dev
->
priv
,
0
,
sizeof
(
struct
arlan_private
));
((
struct
arlan_private
*
)
dev
->
priv
)
->
conf
=
kmalloc
(
sizeof
(
struct
arlan_shmem
),
GFP_KERNEL
);
if
(
dev
==
NULL
||
dev
->
priv
==
NULL
||
((
struct
arlan_private
*
)
dev
->
priv
)
->
conf
==
NULL
)
{
return
0
;
printk
(
KERN_CRIT
" No memory at arlan_allocate_device
\n
"
);
}
/* Fill in the 'dev' fields. */
/* Fill in the 'dev' fields. */
dev
->
base_addr
=
0
;
dev
->
base_addr
=
0
;
dev
->
mem_start
=
0
;
dev
->
mem_start
=
0
;
...
@@ -2056,6 +2053,7 @@ int init_module(void)
...
@@ -2056,6 +2053,7 @@ int init_module(void)
void
cleanup_module
(
void
)
void
cleanup_module
(
void
)
{
{
int
i
=
0
;
int
i
=
0
;
struct
arlan_private
ap
;
ARLAN_DEBUG_ENTRY
(
"cleanup_module"
);
ARLAN_DEBUG_ENTRY
(
"cleanup_module"
);
...
@@ -2069,13 +2067,14 @@ void cleanup_module(void)
...
@@ -2069,13 +2067,14 @@ void cleanup_module(void)
// release_mem_region(virt_to_phys(arlan_device[i]->mem_start), 0x2000 );
// release_mem_region(virt_to_phys(arlan_device[i]->mem_start), 0x2000 );
unregister_netdev
(
arlan_device
[
i
]);
unregister_netdev
(
arlan_device
[
i
]);
if
(
arlan_device
[
i
]
->
priv
)
ap
=
arlan_device
[
i
]
->
priv
;
{
if
(
ap
->
init_etherdev_alloc
)
{
if
(((
struct
arlan_private
*
)
arlan_device
[
i
]
->
priv
)
->
conf
)
kfree
(((
struct
arlan_private
*
)
arlan_device
[
i
]
->
priv
)
->
conf
);
kfree
(
arlan_device
[
i
]);
kfree
(
arlan_device
[
i
]);
arlan_device
[
i
]
=
NULL
;
}
else
{
kfree
(
ap
);
ap
=
NULL
;
}
}
arlan_device
[
i
]
=
NULL
;
}
}
}
}
ARLAN_DEBUG_EXIT
(
"cleanup_module"
);
ARLAN_DEBUG_EXIT
(
"cleanup_module"
);
...
...
drivers/net/arlan.h
View file @
b2e68602
...
@@ -410,6 +410,7 @@ struct arlan_private {
...
@@ -410,6 +410,7 @@ struct arlan_private {
int
out_time10
;
int
out_time10
;
int
in_bytes10
;
int
in_bytes10
;
int
out_bytes10
;
int
out_bytes10
;
int
init_etherdev_alloc
;
};
};
...
...
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