Browse Source

Bug 690584 - #10652 #10651 #10650 #10649 #10648 #10647 send_specific_attrs send_all_attrs - fix coverity resource leak issues

https://bugzilla.redhat.com/show_bug.cgi?id=690584
Resolves: bug 690584
Bug Description: #10652 #10651 #10650 #10649 #10648 #10647 send_specific_attrs send_all_attrs - fix coverity resource leak issues
Reviewed by: nkinder (Thanks!)
Branch: master
Fix Description: if it is possible for slapi_vattr_namespace_values_get_sp with rc != 0 or
item_count == 0, make sure to free the values allocated
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
Rich Megginson 14 years ago
parent
commit
d91cd6344c
1 changed files with 10 additions and 0 deletions
  1. 10 0
      ldap/servers/slapd/result.c

+ 10 - 0
ldap/servers/slapd/result.c

@@ -1045,6 +1045,11 @@ static int send_all_attrs(Slapi_Entry *e,char **attrs,Slapi_Operation *op,Slapi_
 				}
 
 			} else {
+				/* if we got here, then either values is NULL or values contains no elements
+				   either way we can free it */
+				slapi_ch_free((void**)&values);
+				slapi_ch_free((void**)&actual_type_name);
+				slapi_ch_free((void**)&type_name_disposition);
 				rc = 0;
 			}
 		}		
@@ -1177,6 +1182,11 @@ int send_specific_attrs(Slapi_Entry *e,char **attrs,Slapi_Operation *op,Slapi_PB
 				}
 
 			} else {
+				/* if we got here, then either values is NULL or values contains no elements
+				   either way we can free it */
+				slapi_ch_free((void**)&values);
+				slapi_ch_free((void**)&actual_type_name);
+				slapi_ch_free((void**)&type_name_disposition);
 				rc = 0;
 			}
         }