# HG changeset patch # User Sascha Wilde # Date 1396028314 -3600 # Node ID 4b67cc2d4dad60f6c6f5c6682f1f40856aafdd58 # Parent 809eaca3898cff6ef42d59eb26186e4f286196b7# Parent c05e126b0b9e39dff2f5a24752a494c04cdb609e Merged diff -r c05e126b0b9e -r 4b67cc2d4dad cinst/CMakeLists.txt --- a/cinst/CMakeLists.txt Fri Mar 28 15:21:02 2014 +0000 +++ b/cinst/CMakeLists.txt Fri Mar 28 18:38:34 2014 +0100 @@ -30,6 +30,7 @@ if(NSS_FOUND) include_directories(${NSS_INCLUDE_DIRS}) set(MOZILLA_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/nss-secitemlist.c ${CMAKE_CURRENT_SOURCE_DIR}/mozilla.c ) add_executable(mozilla ${MOZILLA_SOURCES}) diff -r c05e126b0b9e -r 4b67cc2d4dad cinst/mozilla.c --- a/cinst/mozilla.c Fri Mar 28 15:21:02 2014 +0000 +++ b/cinst/mozilla.c Fri Mar 28 18:38:34 2014 +0100 @@ -367,6 +367,7 @@ DEBUGPRINTF("Successfully b64 decoded cert: '"); write(2, dercert, dercertlen); fprintf(stderr,"'\n"); + free(dercert); parserr = false; } else diff -r c05e126b0b9e -r 4b67cc2d4dad cinst/nss-secitemlist.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cinst/nss-secitemlist.c Fri Mar 28 18:38:34 2014 +0100 @@ -0,0 +1,28 @@ +#include "nss-secitemlist.h" + +void +seciteml_push (seciteml_t **list, SECItem *item) +{ + seciteml_t *newlelt; + SECItem *newitem; + newlelt = (seciteml_t *)xmalloc( sizeof(seciteml_t) ); + newitem = (SECItem *)xmalloc( sizeof(SECItem) ); + memcpy(newitem, item, sizeof(SECItem)); + newlelt->item = newitem; + newlelt->next = *list; + *list = newlelt; +} + +SECItem *seciteml_pop (seciteml_t **list) +{ + seciteml_t *oldlelt; + SECItem *item = NULL; + + if (*list != NULL) + { + oldlelt = *list; + item = oldlelt->item; + *list = oldlelt->next; + } + return(item); +} diff -r c05e126b0b9e -r 4b67cc2d4dad cinst/nss-secitemlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cinst/nss-secitemlist.h Fri Mar 28 18:38:34 2014 +0100 @@ -0,0 +1,40 @@ +#ifndef NSS_SECITEMLIST_H +#define NSS_SECITEMLIST_H + +/** + * @file + * @brief Functions to handle lists of NSS SECItem-s. + */ + +#include +#include "strhelp.h" + +struct seciteml { + SECItem *item; + struct seciteml *next; +}; + +/** + * @brief Type for SECItem lists + */ +typedef struct seciteml seciteml_t; + +/** + * @brief Prepend a new SECItem to list + * + * The data will be copied. + * @param[inout] list pointer to the list to which the item will be added. + * @param[in] item the SECItem to add to the list. + */ +void seciteml_push (seciteml_t **list, SECItem *item); + +/** + * @brief Remove and return first SECItem from list + * + * @param[inout] list pointer to the list to which the item will be added. + * @retruns the removed item, or NULL if list is empty. + * The caller shoud free this item after use. + */ +SECItem *seciteml_pop (seciteml_t **list); + +#endif