~ubuntu-branches/ubuntu/quantal/asterisk/quantal

« back to all changes in this revision

Viewing changes to channels/misdn_config.c

  • Committer: Bazaar Package Importer
  • Author(s): Jean-Michel Dault
  • Date: 2010-02-16 14:08:54 UTC
  • mfrom: (1.2.5 upstream) (8.3.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100216140854-rb2godspb9lduazl
Tags: 1:1.6.2.2-1ubuntu1
* Merge from Debian: security update
  * Changes:
  - debian/control: Change Maintainer
  - debian/control: Removed Uploaders field.
  - debian/control: Removed Debian Vcs-Svn entry and replaced with
      ubuntu-voip Vcs-Bzr, to reflect divergence in packages.
  - debian/asterisk.init : chown /dev/dahdi
  - debian/backports/hardy : add file
  - debian/backports/asterisk.init.hardy : add file

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
#include "asterisk.h"
30
30
 
31
 
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 212509 $")
 
31
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 222802 $")
32
32
 
33
33
#include "chan_misdn_config.h"
34
34
 
875
875
 
876
876
        switch (type) {
877
877
        case MISDN_CTYPE_STR:
 
878
                if (dest->str) {
 
879
                        ast_free(dest->str);
 
880
                }
878
881
                if ((len = strlen(value))) {
879
882
                        dest->str = ast_malloc((len + 1) * sizeof(char));
880
883
                        strncpy(dest->str, value, len);
894
897
                        res = sscanf(value, "%30d", &tmp);
895
898
                }
896
899
                if (res) {
897
 
                        dest->num = ast_malloc(sizeof(int));
 
900
                        if (!dest->num) {
 
901
                                dest->num = ast_malloc(sizeof(int));
 
902
                        }
898
903
                        memcpy(dest->num, &tmp, sizeof(int));
899
904
                } else
900
905
                        re = -1;
901
906
        }
902
907
                break;
903
908
        case MISDN_CTYPE_BOOL:
904
 
                dest->num = ast_malloc(sizeof(int));
 
909
                if (!dest->num) {
 
910
                        dest->num = ast_malloc(sizeof(int));
 
911
                }
905
912
                *(dest->num) = (ast_true(value) ? 1 : 0);
906
913
                break;
907
914
        case MISDN_CTYPE_BOOLINT:
908
 
                dest->num = ast_malloc(sizeof(int));
 
915
                if (!dest->num) {
 
916
                        dest->num = ast_malloc(sizeof(int));
 
917
                }
909
918
                if (sscanf(value, "%30d", &tmp)) {
910
919
                        memcpy(dest->num, &tmp, sizeof(int));
911
920
                } else {
924
933
                }
925
934
                break;
926
935
        case MISDN_CTYPE_ASTGROUP:
927
 
                dest->grp = ast_malloc(sizeof(ast_group_t));
 
936
                if (!dest->grp) {
 
937
                        dest->grp = ast_malloc(sizeof(ast_group_t));
 
938
                }
928
939
                *(dest->grp) = ast_get_group(value);
929
940
                break;
930
941
        }