|
@@ -302,9 +302,11 @@ static struct oarchive oa_default = {
|
|
|
|
|
|
struct iarchive *create_buffer_iarchive(char *buffer, int len)
|
|
|
{
|
|
|
- struct iarchive *ia = malloc(sizeof(*ia));
|
|
|
- struct buff_struct *buff = malloc(sizeof(struct buff_struct));
|
|
|
+ struct iarchive *ia;
|
|
|
+ struct buff_struct *buff;
|
|
|
+ ia = malloc(sizeof(*ia));
|
|
|
if (!ia) return 0;
|
|
|
+ buff = malloc(sizeof(struct buff_struct));
|
|
|
if (!buff) {
|
|
|
free(ia);
|
|
|
return 0;
|
|
@@ -319,9 +321,11 @@ struct iarchive *create_buffer_iarchive(char *buffer, int len)
|
|
|
|
|
|
struct oarchive *create_buffer_oarchive()
|
|
|
{
|
|
|
- struct oarchive *oa = malloc(sizeof(*oa));
|
|
|
- struct buff_struct *buff = malloc(sizeof(struct buff_struct));
|
|
|
+ struct oarchive *oa;
|
|
|
+ struct buff_struct *buff;
|
|
|
+ oa = malloc(sizeof(*oa));
|
|
|
if (!oa) return 0;
|
|
|
+ buff = malloc(sizeof(struct buff_struct));
|
|
|
if (!buff) {
|
|
|
free(oa);
|
|
|
return 0;
|