Browse Source

modules/sca: free previous appearance owner, callee, dialog if non-NULL.

Andrew Mortensen 12 years ago
parent
commit
36ad807456
1 changed files with 36 additions and 0 deletions
  1. 36 0
      modules/sca/sca_appearance.c

+ 36 - 0
modules/sca/sca_appearance.c

@@ -152,6 +152,16 @@ sca_appearance_free( sca_appearance *appearance )
 	    shm_free( appearance->dialog.id.s );
 	}
 
+        if ( appearance->prev_owner.s != NULL ) {
+            shm_free( appearance->prev_owner.s );
+        }
+        if ( appearance->prev_callee.s != NULL ) {
+            shm_free( appearance->prev_callee.s );
+        }
+        if ( appearance->prev_dialog.id.s != NULL ) {
+            shm_free( appearance->prev_dialog.id.s );
+        }
+
 	shm_free( appearance );
     }
 }
@@ -261,6 +271,32 @@ sca_appearance_list_unlink_index( sca_appearance_list *app_list, int idx )
     return( app );
 }
 
+    int
+sca_appearance_list_unlink_appearance( sca_appearance_list *app_list,
+	sca_appearance **app )
+{
+    sca_appearance	**cur;
+    int			rc = 0;
+
+    assert( app_list != NULL );
+    assert( app != NULL && *app != NULL );
+
+    for ( cur = &app_list->appearances; *cur != NULL; cur = &(*cur)->next ) {
+	if ( *cur == *app ) {
+	    *cur = (*cur)->next;
+
+	    (*app)->appearance_list = NULL;
+	    (*app)->next = NULL;
+
+	    rc = 1;
+
+	    break;
+	}
+    }
+
+    return( rc );
+}
+
     int
 sca_appearance_list_aor_cmp( str *aor, void *cmp_value )
 {