From owner-p4-projects@FreeBSD.ORG Wed Jun 20 11:49:48 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2281016A46B; Wed, 20 Jun 2007 11:49:48 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E6F8C16A400 for ; Wed, 20 Jun 2007 11:49:47 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id D7EE913C468 for ; Wed, 20 Jun 2007 11:49:47 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l5KBnlRr062574 for ; Wed, 20 Jun 2007 11:49:47 GMT (envelope-from andrew@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l5KBnlUM062566 for perforce@freebsd.org; Wed, 20 Jun 2007 11:49:47 GMT (envelope-from andrew@freebsd.org) Date: Wed, 20 Jun 2007 11:49:47 GMT Message-Id: <200706201149.l5KBnlUM062566@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to andrew@freebsd.org using -f From: Andrew Turner To: Perforce Change Reviews Cc: Subject: PERFORCE change 122033 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2007 11:49:48 -0000 http://perforce.freebsd.org/chv.cgi?CH=122033 Change 122033 by andrew@andrew_hermies on 2007/06/20 11:49:02 Add facund_object_free to free memory used by objects Affected files ... .. //depot/projects/soc2007/andrew-update/lib/facund_object.c#3 edit .. //depot/projects/soc2007/andrew-update/lib/facund_object.h#2 edit .. //depot/projects/soc2007/andrew-update/lib/facund_server.c#7 edit Differences ... ==== //depot/projects/soc2007/andrew-update/lib/facund_object.c#3 (text+ko) ==== @@ -292,6 +292,30 @@ return obj->obj_array[pos]; } +/* + * Free an object and it's children + */ +void +facund_object_free(struct facund_object *obj) +{ + if (obj == NULL) + return; + + if (obj->obj_string != NULL) + free(obj->obj_string); + + if (obj->obj_array != NULL) { + unsigned int i; + + for (i = 0; obj->obj_array[i] != NULL; i++) { + facund_object_free(obj->obj_array[i]); + } + free(obj->obj_array); + } + + free(obj); +} + struct facund_object * facund_object_new_from_typestr(const char *type) { ==== //depot/projects/soc2007/andrew-update/lib/facund_object.h#2 (text+ko) ==== @@ -72,6 +72,8 @@ const struct facund_object *facund_object_get_array_item(struct facund_object *, unsigned int); +void facund_object_free(struct facund_object *); + struct facund_object *facund_object_new_from_typestr(const char *); int facund_object_set_from_str(struct facund_object *, const char *); ==== //depot/projects/soc2007/andrew-update/lib/facund_server.c#7 (text+ko) ==== @@ -211,7 +211,7 @@ conn->call_arg); conn->current_call[0] = '\0'; conn->call_id[0] = '\0'; - /* TODO: Free the call_arg */ + facund_object_free(conn->call_arg); conn->call_arg = NULL; } else if (strcmp(name, "data") == 0) { /*