comparison lwlib/lw_stringlist.c @ 429:33c5bc04ea67

Fixed unitialized memory in lw_stringlist_create()
author lost@l-w.ca
date Sun, 19 Sep 2010 12:32:52 -0600
parents 80826bf2827b
children
comparison
equal deleted inserted replaced
428:637f46c5b2b7 429:33c5bc04ea67
28 #include "lw_string.h" 28 #include "lw_string.h"
29 #include "lw_alloc.h" 29 #include "lw_alloc.h"
30 30
31 lw_stringlist_t lw_stringlist_create(void) 31 lw_stringlist_t lw_stringlist_create(void)
32 { 32 {
33 return lw_alloc(sizeof(struct lw_stringlist_priv)); 33 lw_stringlist_t s;
34
35
36 s = lw_alloc(sizeof(struct lw_stringlist_priv));
37 s -> strings = NULL;
38 s -> nstrings = 0;
39 s -> cstring = 0;
40
41 return s;
34 } 42 }
35 43
36 void lw_stringlist_destroy(lw_stringlist_t S) 44 void lw_stringlist_destroy(lw_stringlist_t S)
37 { 45 {
38 if (S) 46 if (S)