Memory leak of pointer 'agp_info'
at line 119 of src/common_capability.c in function 'pci_fill_capabilities_generic'.
'agp_info' allocated at line 107 with calloc(1, 12).
'agp_info' leaks when err != 0 at line 118.
at line 124 of src/common_capability.c in function 'pci_fill_capabilities_generic'.
'agp_info' allocated at line 107 with calloc(1, 12).
'agp_info' leaks when err != 0 at line 123.
[ This bug was found by the Parfait bug checking tool.
For more information see http://research.sun.com/projects/parfait ]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
switch ( cap_id ) {
case 2: {
- struct pci_agp_info * agp_info = calloc( 1, sizeof( struct pci_agp_info ) );
+ struct pci_agp_info * agp_info;
uint32_t agp_status;
uint8_t agp_ver;
- if ( agp_info == NULL ) {
- return ENOMEM;
- }
-
-
err = pci_device_cfg_read_u8( dev, & agp_ver, cap_offset + 2 );
if ( err ) {
return err;
return err;
}
+ agp_info = calloc( 1, sizeof( struct pci_agp_info ) );
+ if ( agp_info == NULL ) {
+ return ENOMEM;
+ }
+
agp_info->config_offset = cap_offset;
agp_info->major_version = (agp_ver & 0x0f0) >> 4;