Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 46956
b: refs/heads/master
c: bb5aa42
h: refs/heads/master
v: v3
  • Loading branch information
Akinobu Mita authored and David S. Miller committed Feb 8, 2007
1 parent 4b44002 commit 5d13eec
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 22f8cde5bc336fd19603bb8c4572b33d14f14f87
refs/heads/master: bb5aa42734e72b3f02fc0b3cdd6105083f9880f1
40 changes: 40 additions & 0 deletions trunk/net/irda/irias_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ struct ias_object *irias_new_object( char *name, int id)

obj->magic = IAS_OBJECT_MAGIC;
obj->name = strndup(name, IAS_MAX_CLASSNAME);
if (!obj->name) {
IRDA_WARNING("%s(), Unable to allocate name!\n",
__FUNCTION__);
kfree(obj);
return NULL;
}
obj->id = id;

/* Locking notes : the attrib spinlock has lower precendence
Expand All @@ -101,6 +107,7 @@ struct ias_object *irias_new_object( char *name, int id)
if (obj->attribs == NULL) {
IRDA_WARNING("%s(), Unable to allocate attribs!\n",
__FUNCTION__);
kfree(obj->name);
kfree(obj);
return NULL;
}
Expand Down Expand Up @@ -357,6 +364,15 @@ void irias_add_integer_attrib(struct ias_object *obj, char *name, int value,

/* Insert value */
attrib->value = irias_new_integer_value(value);
if (!attrib->name || !attrib->value) {
IRDA_WARNING("%s: Unable to allocate attribute!\n",
__FUNCTION__);
if (attrib->value)
irias_delete_value(attrib->value);
kfree(attrib->name);
kfree(attrib);
return;
}

irias_add_attrib(obj, attrib, owner);
}
Expand Down Expand Up @@ -391,6 +407,15 @@ void irias_add_octseq_attrib(struct ias_object *obj, char *name, __u8 *octets,
attrib->name = strndup(name, IAS_MAX_ATTRIBNAME);

attrib->value = irias_new_octseq_value( octets, len);
if (!attrib->name || !attrib->value) {
IRDA_WARNING("%s: Unable to allocate attribute!\n",
__FUNCTION__);
if (attrib->value)
irias_delete_value(attrib->value);
kfree(attrib->name);
kfree(attrib);
return;
}

irias_add_attrib(obj, attrib, owner);
}
Expand Down Expand Up @@ -424,6 +449,15 @@ void irias_add_string_attrib(struct ias_object *obj, char *name, char *value,
attrib->name = strndup(name, IAS_MAX_ATTRIBNAME);

attrib->value = irias_new_string_value(value);
if (!attrib->name || !attrib->value) {
IRDA_WARNING("%s: Unable to allocate attribute!\n",
__FUNCTION__);
if (attrib->value)
irias_delete_value(attrib->value);
kfree(attrib->name);
kfree(attrib);
return;
}

irias_add_attrib(obj, attrib, owner);
}
Expand Down Expand Up @@ -473,6 +507,12 @@ struct ias_value *irias_new_string_value(char *string)
value->type = IAS_STRING;
value->charset = CS_ASCII;
value->t.string = strndup(string, IAS_MAX_STRING);
if (!value->t.string) {
IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
kfree(value);
return NULL;
}

value->len = strlen(value->t.string);

return value;
Expand Down

0 comments on commit 5d13eec

Please sign in to comment.